List:General Discussion« Previous MessageNext Message »
From:Ian Zabel Date:November 18 2002 4:35pm
Subject:Insert row in x for every row in y
View as plain text  
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.


Thread
Insert row in x for every row in yIan Zabel18 Nov
  • RE: Insert row in x for every row in yAdam Nelson18 Nov
    • RE: Insert row in x for every row in yKeith C. Ivey18 Nov
  • re: Insert row in x for every row in yEgor Egorov19 Nov
    • RE: Insert row in x for every row in yKaruna Bhavnani19 Nov