我有下表:
我想删除前三列中的重复值以包含下表:
我该怎么做?我在这个网站上尝试了几种解决方案但没有成功。
答案 0 :(得分:0)
您可以使用相关的子查询来模拟row_number,从那里可以使用case表达式。
select
case when rn = 1 then title else '' end as title,
case when rn = 1 then matter else '' end as matter
-- ...
from (
select *
, (select count(*) from tbl as t2
where t2.title = t1.title
and t2.date <= t1.date) as rn
from tbl as t1
) as t