You probably want the IN comparison operator (http://www.mysql.com/doc/en/Comparison_Operators.html)

For example:

UPDATE users SET status=no WHERE name IN ('Joe', 'Wally', 'Bob', 'Cynthia');

Of course, you can create this statement from the list of names by joining all of the names with commas.

Good luck!

-Doug Sims



Jonathan Villa wrote:

I have a loop which is similar to the following:

while(array contains elements) {
UPDATE users SET status = no WHERE name = array[i]
}
great, it works but the query runs many times. I want to make only one
call to the database and have all the elements in the array be included
in the query








-- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe: http://lists.mysql.com/[EMAIL PROTECTED]



Reply via email to