|
![]() |
![]() |
![]() |
![]() |
![]() |
![]() |
#1 |
Vagabond
|
Mysql query
My mind is completely blank right now, so please help me out here
![]() Table: sponsor | keyword | banner sponsor1 | horizontal | banner1.jpg sponsor1 | vertical | banner2.jpg sponsor1 | button | banner3.jpg sponsor2 | horizontal | banner4.jpg sponsor2 | vertical | banner5.jpg sponsor3 | horizontal | banner6.jpg sponsor3 | vertical | banner7.jpg sponsor3 | small | banner8.jpg Sponsor1 has: horizontal, vertical and button banners Sponsor2 has: horizontal, vertical Sponsor3 has: horizontal, vertical and small Now I want to make a query that gets me this info: " Find a sponsor that has horizontal and vertical and (button or small) " I made a quick and dirty to find sponsor that has horizontal and vertical and ..... banners. SELECT COUNT(DISTINCT keyword) from table WHERE keyword LIKE 'horizontal' OR keyword LIKE 'vertical' If I was looking for 2 kinds of banners and the query returned a 2, BINGO! I'm at a loss how to do it differently. So if anyone got a different way and a solution to the first query, I'm all ears ![]() |
![]() |
![]() |
|
|