Zabel,
Monday, November 18, 2002, 6:35:06 PM, you wrote:

ZI> I've having trouble figuring out the SQL to do this.

ZI> I have two tables, user, and group_map, and I want to insert a row into
ZI> group_map for every row in user.

ZI> user
ZI> ------------
ZI> user_id


ZI> group_map
ZI> ------------
ZI> user_id
ZI> group_id


ZI> For each user_id:
ZI>         insert into group_map ( user_id, group_id ) values ( user_id, 6
ZI> )

ZI> Can I use a select into or something? Or should I just script it outside
ZI> of mysqlclient?

Sure, you can.

INSERT INTO group_map(user_id, group_id) SELECT user.user_id, 6 FROM user;




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




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