Jump to content


Photo

select syntax wrong?


  • Please log in to reply
3 replies to this topic

#1 Wetzut

Wetzut
  • New Members
  • Pip
  • Newbie
  • 2 posts
  • LocationKerken, Germany

Posted 25 March 2003 - 05:47 PM

hi

i\'ve a prob:

i need to select some rows from my table. every row got an id.
How can i get all these rows with diffrent ids into one select query?

i tried this:

select * from `my_table` where `id` = ( \'2\',\'3\',\'6\',\'27\')

is it possible to solve this problem in this way or must i try an other one?

thx 4 help

#2 shivabharat

shivabharat
  • Members
  • PipPipPip
  • Advanced Member
  • 371 posts
  • LocationChennai, India

Posted 25 March 2003 - 06:26 PM

select * from `my_table` where `id` = 2 || `id` = 3 || `id` = 6 || `id` = 27

Hope this helps
Knowledge --- Reading Enriches Mind But Sharing Enhances It.[br][br]Note: Before you request help enusre that you have had a look at the tutorials @phpfreaks

#3 Wetzut

Wetzut
  • New Members
  • Pip
  • Newbie
  • 2 posts
  • LocationKerken, Germany

Posted 25 March 2003 - 07:58 PM

Yes it works great. Thx for help


(What means this \"||\" in this case? Same as an AND or an OR? Because i tried out my select with an AND instead of ||)

#4 shivabharat

shivabharat
  • Members
  • PipPipPip
  • Advanced Member
  • 371 posts
  • LocationChennai, India

Posted 25 March 2003 - 08:04 PM

Yes u are right

|| is AND
&& is OR


Knowledge --- Reading Enriches Mind But Sharing Enhances It.[br][br]Note: Before you request help enusre that you have had a look at the tutorials @phpfreaks




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users