Adding an autonumber that resets every month

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • rsen
    New Member
    • Apr 2008
    • 1

    Adding an autonumber that resets every month

    I have a simple SQL server table with 4 fields - id, date, transactions.
    I want to create an additional column that gives the ranking of each record within that month based on the number of transactions.
    Is there any easy way to do this ?
  • debasisdas
    Recognized Expert Expert
    • Dec 2006
    • 8119

    #2
    If you want only for display purpose no need tro create an addition column.

    Comment

    • Brad Orders
      New Member
      • Feb 2008
      • 21

      #3
      I would suggest that the approach that you take will depend on what you want to do with the data. If you are wanting to only return one month at a time (for example, the user provides a month and you return all the records for the month), then you could query the table, order by Transactions DESC, and put this into a temporary table that has a auto increment. Then you could SELECT the temp table, and the increment would give you the number you are after.

      Hope this helps.

      Comment

      Working...