"Jim Zarvis" <[EMAIL PROTECTED]> wrote:
> What is good clean sql syntax to accomplish the following with MySQL:
> SELECT * FROM tablename WHERE value is in array of values
>
> i.e. (psudocode)
>
> Assume I have a field called ID in my table, and that I have 20 Rows (with
> ID's 1-20)
>
> myarray = (1,3,4)
>
> I want to return all the fields where ID = 1 and 3 and 4

SELECT * FROM table_name WHERE field_name IN (1,2,3);

See the online manual for more details.

--
Steve Werby
President, Befriend Internet Services LLC
http://www.befriend.com/


---------------------------------------------------------------------
Before posting, please check:
   http://www.mysql.com/manual.php   (the manual)
   http://lists.mysql.com/           (the list archive)

To request this thread, e-mail <[EMAIL PROTECTED]>
To unsubscribe, e-mail <[EMAIL PROTECTED]>
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php

Reply via email to