Need help in select query

  • Hi All,

    I have table of data as follows:

    20278123

    20278123

    20278123

    20329456

    20329456

    20329456

    20421919

    20421919

    20421920

    I have to write a select query to get data like below:

    20278123 1

    20278123 2

    20278123 3

    20329456 1

    20329456 2

    20329456 3

    20421919 1

    20421919 2

    20421919 1

    Please help me in writing the query.

    Thanks in adavance,

    Ravi.

  • Check out this article http://www.sqlservercentral.com/articles/T-SQL/69717/

    You should end up with something like

    SELECT DATE, ROW_NUMBER() OVER(PARTITION BY Date ORDR BY Date) AS RN

  • Thank you so much, it works.

Viewing 3 posts - 1 through 2 (of 2 total)

You must be logged in to reply to this topic. Login to reply