Jump to content

WHERE WHERE WHERE


NoDoze

Recommended Posts

SQL grammar is a bit diffrent ;)

 

Imagine that you take one row from a table at a time, and check if it matches conditions. You find a row that has type = 'presentation'

 

 

If the condition is: type='presentation' AND type='publication'

you say: 'let's see.. hmm.. the type is 'presentation' fine... now I check another part of condition... oops... the type is not 'publication', this row does not match criteria

 

If the condition is: type='publication' OR type='presentation'

you say: 'let's see.. hmm.. the type is not 'publication' but there's another condition, let's check it... the type can also be 'presentation'.. it is! this row matches criteria

 

This post was brought to you by late night SQL stories.

 

Link to comment
https://forums.phpfreaks.com/topic/152142-where-where-where/#findComment-799041
Share on other sites

SQL grammar is a bit diffrent ;)

 

Imagine that you take one row from a table at a time, and check if it matches conditions. You find a row that has type = 'presentation'

 

 

If the condition is: type='presentation' AND type='publication'

you say: 'let's see.. hmm.. the type is 'presentation' fine... now I check another part of condition... oops... the type is not 'publication', this row does not match criteria

 

If the condition is: type='publication' OR type='presentation'

you say: 'let's see.. hmm.. the type is not 'publication' but there's another condition, let's check it... the type can also be 'presentation'.. it is! this row matches criteria

 

This post was brought to you by late night SQL stories.

 

 

LMAO, I like that, good sense of humour.

 

Helps make learning a little less boring =D

Link to comment
https://forums.phpfreaks.com/topic/152142-where-where-where/#findComment-799047
Share on other sites

hehe...funny...

 

Now I have an additional question...kinda related....

 

I also have a column for keywords (keyw) with entries like, on some rows:

bh nn ds bdb bkh

another row

bh ds

another row

bdb

 

I want the query to pull up all records that have bh in the keyw, how would I do this?

Cause right now with a query for bh, it's not pullin up anything cause it sees the entire row 'bh nn ds bdb bkh' as a value.

 

WHERE type='report' AND keyw='bh'

 

Would I use %bh%, or bh%...? But neither of those pull up anything either....

 

Thanks!

 

Link to comment
https://forums.phpfreaks.com/topic/152142-where-where-where/#findComment-799873
Share on other sites

Archived

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

×
×
  • Create New...

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.