我下面有一张桌子:
id | echantillon_dta | Est_en_double
1 | Bonjour | null
2 | Bonjour | null
3 | Bonjour | null
4 | Joke | null
5 | Joke | null
6 | | null 在进程查询之后,将显示如下:
id | echantillon_dta | Est_en_double
1 | Bonjour | 1
2 | Bonjour | 1
3 | Bonjour | 1
4 | Joke | 4
5 | Joke | 4
6 | | null 如何比较串泡弦?以及如何更新这样的列?
发布于 2019-11-01 16:36:46
您似乎希望最小的id具有相同的record_details。
这应该是可行的:
select t.*,
min(id) over (partition by record_details) as isDuplicate
from t;如果您希望将其作为update,则关联子查询是一种简单的方法:
update t
set isduplicate = (select min(t2.id)
from t t2
where t2.record_details = t.record_details
);https://stackoverflow.com/questions/58662735
复制相似问题