答案 0 :(得分:1)
您可以使用first_value()
:
select firstvalue as columnA, id as columnB
from (select *, first_value(id) over (partition by us order by date) as firstvalue
from table
) t
where id <> firstvalue;
如果要插入前一个查询的结果集,请使用INSERT . . INTO
语句
insert into table (columnA, columnB)
select firstvalue as columnA, id as columnB
from (select *, first_value(id) over (partition by us order by date) as firstvalue
from table
) t
where id <> firstvalue;