sql - Ignoring the first duplicate in a list -
i'm quite new sql have managed select statement works shows fullpath, md5checksum , number of times md5cheksum appears. want code ignores first time md5checksum appears.
here current statement;
select f.fullpath ,f.md5checksum ,[tbl.finance].count [tbl.finance] f inner bring together ( select md5checksum ,count(*) count [tbl.finance] grouping md5checksum having count(*) > 1 ) [tbl.finance] on f.md5checksum = [tbl.finance].md5checksum order md5checksum
if can help great. thanks
with cte as( select f.fullpath ,f.md5checksum ,[tbl.finance].count ,row_number() on (partition f.md5checksum order f.md5checksum) rn [tbl.finance] f inner bring together (select md5checksum ,count(*) count [tbl.finance] grouping md5checksum having count(*) > 1 ) [tbl.finance] on f.md5checksum = [tbl.finance].md5checksum) select * cte rn>1
sql sql-server function duplicates
No comments:
Post a Comment