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 |
|
rajani
Constraint Violating Yak Guru
367 Posts |
Posted - 2004-12-02 : 23:15:09
|
| Hi FriendsI've following fields in a table.in some records all fields will be same except transdate field (which contains date when this particular record is created)claim,transdate,ctype,srvprovno how can i write a sql which returns latest record(if there r multiples)sample dataclaim,transdate,ctype,srvprovno 001,12/11/04,h,1233H001,03/12/04,h,1233H002,02/12/04,T,1111H003,12/11/04,S,0111H003,13/11/04,S,0111Hfor the above data i want following result001,03/12/04,h,1233H002,02/12/04,T,1111H003,13/11/04,S,0111HPlease suggest sql for this.I tried ading group by but that did not return the data i wanted.ThanksCheers |
|
|
Hippi
Yak Posting Veteran
63 Posts |
Posted - 2004-12-03 : 00:58:10
|
| May be this query will work for uselect claim, max(transdate), ctype, srvprovno from tablegroup by claim, ctype, srvpronvoHTH |
 |
|
|
rajani
Constraint Violating Yak Guru
367 Posts |
Posted - 2004-12-04 : 15:56:29
|
| HippiThat's great.it worked beautifully for me :-)Cheers |
 |
|
|
|
|
|
|
|