I have below question: Want to find the consecutive duplicates
SLNO NAME PG 1 A1 NO 2 A2 YES
Try to use row_number()
select SLNO, Name, PG, row_number() over (partition by PG order by PG) as 'Consecutive' from order by SLNO, NAME, PG This is should work with minor tweaking. --EDIT-- Sorry, partiton by PG. The partitioning tells the row_number when to start a new sequence. 0 讨论(0) 查看其它6个回答 发布评论: 提交评论 加载中... 验证码 看不清? 提交回复 热议问题
This is should work with minor tweaking.
--EDIT--
Sorry, partiton by PG. The partitioning tells the row_number when to start a new sequence.