Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
CODE PROJECT For Those Who Code
  • Home
  • Articles
  • FAQ
Community
  1. Home
  2. Database & SysAdmin
  3. Database
  4. Group ranking or row number

Group ranking or row number

Scheduled Pinned Locked Moved Database
help
3 Posts 3 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • L Offline
    L Offline
    Lash20
    wrote on last edited by
    #1

    Hi: I have data that looks like this: iYear RecordID Group 2010 1 A 2010 2 A 2010 3 A 2010 4 D 2010 5 D 2009 6 C 2009 7 C but I need to rank or apply row numbering on the Groups sorted by the RecordID to make the data look like this: iYear RecordID Group Group Ranking 2010 1 A 1 2010 2 A 1 2010 3 A 1 2010 4 D 2 2010 5 D 2 2009 6 C 3 2009 7 C 3 Any help would be greatly appreciated. Thx

    P M 2 Replies Last reply
    0
    • L Lash20

      Hi: I have data that looks like this: iYear RecordID Group 2010 1 A 2010 2 A 2010 3 A 2010 4 D 2010 5 D 2009 6 C 2009 7 C but I need to rank or apply row numbering on the Groups sorted by the RecordID to make the data look like this: iYear RecordID Group Group Ranking 2010 1 A 1 2010 2 A 1 2010 3 A 1 2010 4 D 2 2010 5 D 2 2009 6 C 3 2009 7 C 3 Any help would be greatly appreciated. Thx

      P Offline
      P Offline
      programmervb netc
      wrote on last edited by
      #2

      I would think you could use a case statement to accomplish that but that is probably not the best way.

      Humble Programmer

      1 Reply Last reply
      0
      • L Lash20

        Hi: I have data that looks like this: iYear RecordID Group 2010 1 A 2010 2 A 2010 3 A 2010 4 D 2010 5 D 2009 6 C 2009 7 C but I need to rank or apply row numbering on the Groups sorted by the RecordID to make the data look like this: iYear RecordID Group Group Ranking 2010 1 A 1 2010 2 A 1 2010 3 A 1 2010 4 D 2 2010 5 D 2 2009 6 C 3 2009 7 C 3 Any help would be greatly appreciated. Thx

        M Offline
        M Offline
        Mycroft Holmes
        wrote on last edited by
        #3

        This will make interesting reading[^] for you. Also look into PARTITION and RANK, that will allow you to rank the records over the group

        Never underestimate the power of human stupidity RAH

        1 Reply Last reply
        0
        Reply
        • Reply as topic
        Log in to reply
        • Oldest to Newest
        • Newest to Oldest
        • Most Votes


        • Login

        • Don't have an account? Register

        • Login or register to search.
        • First post
          Last post
        0
        • Categories
        • Recent
        • Tags
        • Popular
        • World
        • Users
        • Groups