Jump to content

Archived

This topic is now archived and is closed to further replies.

tallberg

sql help please!

Recommended Posts

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.

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

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

Share this post


Link to post
Share on other sites
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.

Share this post


Link to post
Share on other sites

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.