View previous topic :: View next topic
|
Author |
Message |
shashikant
New User
Joined: 07 Sep 2007 Posts: 6 Location: chennai
|
|
|
|
Hi,
Here is the scenario:
I have a table with 3 columns with primary field as F1
i want to create another set of these rows but with a primary key as B instead of A in column F1,cloning all other columns as with F1= A
Original table : F1=primary key
F1 F2 F3
A D I
A E J
A F K
A G L
A H M
'''''''''''''
'''''''
''
'
Expected table after INSERT
F1 F2 F3
A D I
A E J
A F K
A G L
A H M
B D I
B E J
B F K
B G L
B H M
'''''''''''''
'''''''
''
'
Hope u guys understand what i implied.
Please assist. |
|
Back to top |
|
|
sushanth bobby
Senior Member
Joined: 29 Jul 2008 Posts: 1020 Location: India
|
|
|
|
shashikant,
What you looking for is
Code: |
insert into table
select 'B',f2,f3 from table |
Not tested.
Sushanth |
|
Back to top |
|
|
dick scherrer
Moderator Emeritus
Joined: 23 Nov 2006 Posts: 19244 Location: Inside the Matrix
|
|
|
|
Hello,
If you want only rows with F1 = A replicated as Bs, add this to the SELECT:
Without this, all rows in the table will be copied with B as the value for F1. |
|
Back to top |
|
|
|