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 |
|
reneelacks
Starting Member
1 Post |
Posted - 2009-03-31 : 23:49:06
|
| I'm trying to pull the maximum DatePosted for each Vendor...VendorName VendorCode OperatorID DatePostedABC Rental 0001 1234 1/1/2008Nottingham 0002 1234 2/3/2008ABC Rental 0001 5678 8/9/2008Fox Chevrolet 0003 5678 10/12/2008Dolls Unity 0004 1234 3/4/2009Chesapeake 0005 5678 11/6/2008Dolls Unity 0004 1234 5/5/2008My desired result:ABC Rental 0001 1234 8/9/2008Nottingham 0002 1234 2/3/2008Fox Chevrolet 0003 5678 10/12/2008Dolls Unity 0004 1234 5/5/2008Chesapeake 0005 5678 11/6/2008Any help would be most appreciated |
|
|
SwePeso
Patron Saint of Lost Yaks
30421 Posts |
Posted - 2009-04-01 : 01:15:02
|
select VendorName, VendorCode, OperatorID, DatePostedfrom (select VendorName, VendorCode, OperatorID, DatePosted, row_number() over (partition by vendorid order by dateposted desc) as recidfrom table1) as fwhere recid = 1 E 12°55'05.63"N 56°04'39.26" |
 |
|
|
|
|
|