Greenguy's Board


Go Back   Greenguy's Board > Programming & Scripting
Register FAQ Calendar Search Today's Posts Mark Forums Read

 
 
Thread Tools Search this Thread Rate Thread Display Modes
Prev Previous Post   Next Post Next
Old 2005-03-20, 10:54 AM   #4
swedguy
Vagabond
 
swedguy's Avatar
 
Join Date: Aug 2003
Posts: 2,374
Send a message via ICQ to swedguy
Quote:
Originally Posted by ronnie
SELECT count
FROM table
WHERE keyword = 'horizontal' AND keyword = 'vertical' AND (keyword = 'small' OR keyword = 'button')

That is to find only sponsors that have horz and vert and butt/small baners. It must match all three conditions to be a match. Is that what you are looking for? Not sure why your using UNION, that is usually for selecting from different tables, if I remember right. Also LIKE is use more for a wildcard type select with % as the wild card.

ronnie
That query will only match on a row, not a whole table. So it will look for a row that has keyword set to horizontal, vertical and (small or button). Which doesn't really work, keyword can only be set to one value in a row
If I would have 3 keyword fields: keyword1, keyword2, keyword3 then I could do it that way.

And LIKE is just an old habit I have since the Sybase days. Mysql isn't as picky when it comes to =/LIKE, if you just put it in quotes it will treat it as a string. But for standard SQL, LIKE is for strings and = is for numerics.
swedguy is offline   Reply With Quote
 

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes Rate This Thread
Rate This Thread:

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 11:10 AM.


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