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 |
|
abacusdotcom
Posting Yak Master
133 Posts |
Posted - 2009-05-26 : 07:30:04
|
| Morning All,May I seek my help here..I have a table keeping history of loan defaulters, the table holds all entries of any loan issues. I want to get the last entry of each accounts/transactions.Sample dataTransID Period DaysAREPDLD0724300270 20080401 406AREPDLD0725500322 20080512 365AREPDLD0725500322 20080612 334AREPDLD0725500322 20080412 395AREPDLD0725500322 20080712 304AREPDLD0725500322 20080312 426AREPDMG0722610484 20071016 574AREPDMG0722611567 20070815 636AREPDMG0722614023 20070822 629AREPDMG0722614023 20071022 568AREPDMG0722614023 20070922 598AREPDMG0722614075 20070920 600AREPDMG0722814902 20080124 474AREPDMG0722814902 20071024 566AREPDMG0722814902 20071224 505AREPDMG0722814902 20080724 292AREPDMG0722814902 20080324 414AREPDMG0722814902 20070824 627AREPDMG0722814902 20071124 535AREPDMG0722814902 20080624 322for example, here AREPDLD0725500322 I want to return 200807 with 304.Thanks.I sign for fame not for shame but all the same, I sign my name. |
|
|
abacusdotcom
Posting Yak Master
133 Posts |
Posted - 2009-05-26 : 07:47:43
|
| Thanks All solved...I used row_number(), and got it solved...ROW_NUMBER() OVER(PARTITION BY x.transid ORDER BY x.period desc) NumEntryDont mind me, I want to deliver in time.. this didnt gimme chance to try mind best first..I sign for fame not for shame but all the same, I sign my name. |
 |
|
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
|
|
ergen
Starting Member
5 Posts |
|
|
|
|
|