Reputation: 563
To insert an identical row to a table I use
Insert into table (select * from table where columnA = 'a' and columnB = 'b')
Am I able to insert and change columnB = 'c' in one sql?
Upvotes: 0
Views: 517
Reputation: 700800
Yes, just specify the value in the select:
insert into table (ColumnA, ColumnB)
select ColumnA, 'c'
from table
where columnA = 'a' and columnB = 'b'
(If you have more columns, just add them in the column list and the select just like ColumnA.)
Upvotes: 3