Greenguy's Board


Go Back   Greenguy's Board > Programming & Scripting
Register FAQ Calendar Today's Posts

 
 
Thread Tools Search this Thread Rate Thread Display Modes
Prev Previous Post   Next Post Next
Old 2005-03-19, 11:57 PM   #1
swedguy
Vagabond
 
swedguy's Avatar
 
Join Date: Aug 2003
Posts: 2,374
Send a message via ICQ to swedguy
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
swedguy is offline   Reply With Quote
 


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 02:58 PM.


Mark Read
Powered by vBulletin® Version 3.8.1
Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
© Greenguy Marketing Inc