TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
darma teja
NA
496
337.5k
same ID different rows in sql
Jul 1 2014 5:46 AM
Hi All,
I want to insert 500 rows in the table.
table has
ID, groupID, name, firstname
My data is like this:
I have
groupIDs
: 1,2,3
I have 500 rows of
name and firstname.
I want to insert these 500 rows of name and firstname for every gorupID
I wrote like this:
insert into table (
groupID, name, firstname)
SELECT 1, 'a', 'b' union all
SELECT 1, 'c', 'd' union all
SELECT 1, 'e', 'f' union all
But it is difficult to write groupID everytime. Is there any solution?
Many thanks,
Darma
Reply
Answers (
1
)
sql statement for top 4
How to apply Lock on sql table?