i feel like i must be missing something simple because i keep wanting to do things 
like this, but i can't find a one step way to do
it.

whether or not there is an easy way, can someone tell me the best way to do it?

i want to update a field in one table based on data in another table.

example:

CREATE TABLE users (userid INT(11) PRIMARY KEY, userinfo_set CHAR(1) NOT NULL DEFAULT 
0);
CREATE TABLE userinfo (userid INT(11) NOT NULL, userinfo TEXT);

<insert a ton of user row, insert 1/2 ton of userinfo rows>

what i want is:

UPDATE users SET userinfo_set=1 where (users.userid=userinfo.userid);

aka, i want to set a flag in every row in users if there is a row in userinfo with the 
same userid.

i've been SELECT INTO OUTFILEing (with a join on the two tables) and LOAD DATA 
INFILEing to deal with this. is there a better way?

thanks!


---------------------------------------------------------------------
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