Jump to content


sql help please!

  • Please log in to reply
1 reply to this topic

#1 tallberg

  • Members
  • PipPipPip
  • Advanced Member
  • 132 posts

Posted 20 October 2006 - 04:31 PM

Can some one please describe to me the difference between these 2 queries. The first one produces 9,658 rows and second on 314 rows. I don't know what the difference is.

FROM `plantsdb`
WHERE Colour_Foliage LIKE '%blue%'
OR Colour_Foliage LIKE '%green%'

FROM `plantsdb`
WHERE Colour_Foliage LIKE '%blue%'
OR '%green%'

#2 fenway

  • Staff Alumni
  • MySQL Si-Fu / PHP Resident Alien
  • 16,199 posts
  • LocationToronto, ON

Posted 20 October 2006 - 04:37 PM

The first query is correct... the second query is simply evaluating '%green%' as being true on some random field, having nothing to do with Colour_Foliage, and is returning garbage.
Seriously... if people don't start reading this before posting, I'm going to consider not answering at all.

0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users