SQL - sub count

Posted by Andy Clarke on Stack Overflow See other posts from Stack Overflow or by Andy Clarke
Published on 2010-05-13T16:40:21Z Indexed on 2010/05/13 16:44 UTC
Read the original article Hit count: 165

Filed under:
|
|

Hi I've got some SQL ...

SELECT  
    AdviceNo,
    Registration
FROM tblSalesDetail

that produces something like ...

ADV00001, ABC123
ADV00001, CDE564
ADV00002, FGE432
ADV00003, HUY789
ADV00003, MJS532
ADV00003, JFY428

Can anyone tell me how I'd adjust it to see the following please?

ADV00001, ABC123, 1
ADV00001, CDE564, 2
ADV00002, FGE432, 1
ADV00003, HUY789, 1
ADV00003, MJS532, 2
ADV00003, JFY428, 3

© Stack Overflow or respective owner

Related posts about sql

Related posts about grouping