Jason Joines <[EMAIL PROTECTED]> wrote:
> Table employees:
> 
>  ------------------------------------
> | idnumber | email | phone | address |
>  ------------------------------------
> 
> Table webusers:
>  -----------------------------
> | idnumber | userid | website |
>  -----------------------------
> 
>   Table employees is completely populated.  Table webusers has the 
> idnumber and website fields completely populated.  What query can I use 
> to insert the email address from each persones record in the employees 
> table into the userid field of their corresponding record in the 
> webusers table?

If I've got you right you need UPDATE, not INSERT .. SELECT.

UPDATE webuser, employees
SET webuser.userid=employees.email
WHERE webuser.idnumber=employees.idnumber;

The above UPDATE statement will work from v4.0.4.



-- 
For technical support contracts, goto https://order.mysql.com/?ref=ensita
This email is sponsored by Ensita.net http://www.ensita.net/
   __  ___     ___ ____  __
  /  |/  /_ __/ __/ __ \/ /    Egor Egorov
 / /|_/ / // /\ \/ /_/ / /__   [EMAIL PROTECTED]
/_/  /_/\_, /___/\___\_\___/   MySQL AB / Ensita.net
       <___/   www.mysql.com




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

Reply via email to