UPDATE users u
SET status = 1
WHERE EXISTS (SELECT id FROM usersold WHERE id = u.id)
Alternate version:
UPDATE users
SET status = 1
WHERE id IN (SELECT id FROM usersold)
You should test and, depending on your database, you may find one performs better than the other although I expect any decent database will optimize then to be much the same anyway.
cletus
2008-12-25 11:26:20