"T.J. Mahaffey" <[EMAIL PROTECTED]> wrote on 10/08/2005 07:09:35 PM:

> I'm working on a PHP script which will already have gathered a large 
> array of string values from a text file. These values will correspond 
> to item numbers in a MySQL table. What I need to do is select rows in 
> the table based on whether or not their "item_number" values are in 
> the pre-existing PHP array. (The idea here is that the website's 
> inventory comes in as a text file. I need to compare that inventory 
> with the items contained within the table and disable the catalog 
> items which are not in current inventory.)
> 
> Something like this (obviously not real code, just an illustration of 
> what I'm trying to get):
> 
> SELECT * in $mytable WHERE in_array('item_number', 
> $arrayfromtextfile) = true
> 
> Of course, in_array() is a PHP function, but I'm hoping there is 
> something similar available in MySQL.
> Is this possible?
> Thanks in advance for any insight someone might provide.
> 
> --
> T.J. Mahaffey
> [EMAIL PROTECTED]
> 

Check this page: 
http://dev.mysql.com/doc/mysql/en/comparison-operators.html

You are looking for the IN comparison operator.

Shawn Green
Database Administrator
Unimin Corporation - Spruce Pine

Reply via email to