Clone rows based on existing rows
-
Can you SQL gurus help me craft an UPDATE statement that will insert a modified clone of a set of rows into a table? For example, my table
FIELDS_IN_VIEW
has 2 columnsVIEW
andFIELD
and contains several thousand rows:Row VIEW FIELD
1 23 100 2 23 701 4 23 459
...
6500 99 804I'd like to clone all the rows that apply to view
23
for a new view (eg:24
). View24
is guaranteed to not already exist in the table. Thanks, /ravi My new year's resolution: 2048 x 1536 Home | Music | Articles | Freeware | Trips ravib(at)ravib(dot)com -
Can you SQL gurus help me craft an UPDATE statement that will insert a modified clone of a set of rows into a table? For example, my table
FIELDS_IN_VIEW
has 2 columnsVIEW
andFIELD
and contains several thousand rows:Row VIEW FIELD
1 23 100 2 23 701 4 23 459
...
6500 99 804I'd like to clone all the rows that apply to view
23
for a new view (eg:24
). View24
is guaranteed to not already exist in the table. Thanks, /ravi My new year's resolution: 2048 x 1536 Home | Music | Articles | Freeware | Trips ravib(at)ravib(dot)comtry it insert into FIELDS_IN_VIEW select 24, field from FIELDS_IN_VIEW where view = 23
-
try it insert into FIELDS_IN_VIEW select 24, field from FIELDS_IN_VIEW where view = 23