Jump to content

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

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.