需要在3個新行中複製1行,每個新行的序列號+1遞增查詢選擇一個記錄,並在序列號列中增加3個副本記錄,每個記錄的最大值爲+1
insert into t1 (column1,column2,column3,sequencecolumn)
( **row1
select *from t1 (column1,'101',column3,sequencecolumn)
(select max (sequencecolumn)+1 where column1 ='abc')
where column1 = 'abc'
)
( ***row2
select *from t1 (column1,'102',column3,sequencecolumn)
(select max (sequencecolumn)+1 where column1 ='abc')
where column1 = 'abc'
)
( ***row3
select *from t1 (column1,'103',column3,sequencecolumn)
(select max (sequencecolumn)+1 where column1 ='abc')
where column1 = 'abc'
)
我需要選擇行,其中列1 = ABC和列2 = 100 ABC,100,SEQ1 .... ............ row1 ....................... abc,100,seq2 ........ RO ....... w2 ........................ abc 099,seq3 ................ row3 ... ..................... 現在如果我需要'sec'.ie的最大seq數。 seq3 但我只需要獲取記錄'abc'和'100' 並複製它,但計數序列應該是seq4 主鍵是'abc'+ seqnumber列..不是列2具有值100 什麼在這種情況下做 –