Unique identifier

C

Chris

Can someone tell me how I could attach a unique indentifier to an order
number. I would like the identifer to increment until the order number
changes sort of like the following:

Order num Identifier

75621 1
75621 2
75621 3
75622 1
75623 1
75623 2

Thanks for any sugestions.
Chris
 
K

KARL DEWEY

That would be ranking in a group.
SELECT Q.Group, Q.Points, (SELECT COUNT(*) FROM Product Q1
WHERE Q1.[Group] = Q.[Group]
AND Q1.Points < Q.Points)+1 AS Rank
FROM Product AS Q
ORDER BY Q.Group, Q.Points;
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top