You can use

insert group_map (user_id,group_id) select user_id,"6" as any_label from
user



> -----Original Message-----
> From: Zabel, Ian [mailto:[EMAIL PROTECTED]] 
> Sent: Monday, November 18, 2002 11:35 AM
> To: [EMAIL PROTECTED]
> Subject: Insert row in x for every row in y
> 
> 
> I've having trouble figuring out the SQL to do this.
> 
> I have two tables, user, and group_map, and I want to insert 
> a row into
> group_map for every row in user.
> 
> user
> ------------
> user_id
> 
> 
> group_map
> ------------
> user_id
> group_id
> 
> 
> For each user_id:
>       insert into group_map ( user_id, group_id ) values ( user_id, 6
> )
> 
> Can I use a select into or something? Or should I just script 
> it outside
> of mysqlclient?
> 
> Ian.
> 
> 
> 


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