php - How to get data matching against multiple column values in same table -



php - How to get data matching against multiple column values in same table -

this question has reply here:

mysql search products attributes 1 reply

how can id of books belong country 79 , author 80 , publisher 91

select id books ( (filter = 'country' , cat = 79) , (filter = 'author' , cat = 80) , (filter = 'publisher' , cat = 91) )

here table structure

+----+----------+-----+ | id | fiter | cat | +----+----------+-----+ | 1 | country | 79 | | 1 | author | 80 | | 1 | publisher| 91 | | 2 | country | 476 | | 2 | author | 85 | | 2 | publisher| 121 | +----+----------+-----+

thank you

this problem kind of table structure, have many filters can't columns on own?. anyway, this:

select distinct id books b filter = 'country' , cat = 79 , exists( select 1 books filter = 'author' , cat = 80 , id = b.id) , exists( select 1 books filter = 'publisher' , cat = 91 , id = b.id);

php mysql sql

Comments

Popular posts from this blog

java - How to set log4j.defaultInitOverride property to false in jboss server 6 -

c - GStreamer 1.0 1.4.5 RTSP Example Server sends 503 Service unavailable -

Using ajax with sonata admin list view pagination -