Reputation: 1455
How do I insert an additional row for all rows in a table? For example, this is the data in my table -
id num name type occupation location
1000056 1326120205 CHRISTOPHER H Physical ASHEVILLE, NC
1030026 1326105 Jennifer Ew F None N/A Meridian, MS
I want the table to now have -
id num name type occupation location
1000056 1326120205 CHRISTOPHER H Physical ASHEVILLE, NC
1000056 1326120205 CHRISTOPHER H Physical State - NC
1030026 1326105 Jennifer Ew F None N/A Meridian, MS
1030026 1326105 Jennifer Ew F None N/A State - MS
Upvotes: 0
Views: 34
Reputation: 1269623
Just use insert . . . select
:
insert into t (id, num, name, type, occupation, location)
select id, num, name, type, occupation, 'State - ' || substr(location, -2)
from t;
Upvotes: 2