Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
| Author |
Topic |
|
Netgame
Starting Member
4 Posts |
Posted - 2009-08-31 : 16:19:50
|
| Hello, I have a header table with a customer number and a detail table with multiple transactions for the header. I am wanting to find a way to gather these detail transactions but rank them 1 through whatever.Can someone help me figure this one out? I wsa thinking of Rank but I could not get that one to work. My example would be...CustNum DetailTransaction1234 11234 21234 31234 43456 13456 23456 33456 47891 17891 28555 1 |
|
|
webfred
Master Smack Fu Yak Hacker
8781 Posts |
Posted - 2009-08-31 : 16:28:04
|
select h.*,d.*,row_number() over (partition by h.custnum order by h.custnum) as rnkfrom header hjoin detail d on h.custnum = d.custnum No, you're never too old to Yak'n'Roll if you're too young to die. |
 |
|
|
Netgame
Starting Member
4 Posts |
Posted - 2009-08-31 : 16:38:49
|
| Awesome.. Thank you. That works just fine. |
 |
|
|
webfred
Master Smack Fu Yak Hacker
8781 Posts |
Posted - 2009-08-31 : 16:43:59
|
welcome  No, you're never too old to Yak'n'Roll if you're too young to die. |
 |
|
|
|
|
|