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 |
Pete_N
Posting Yak Master
181 Posts |
Posted - 2014-11-09 : 10:21:28
|
IF I have two tables, tTrans and tAccounts, tTrans has a guid field (laccount) which holds the Guid for tAccountsand a datefield (createdDate) when the records was createdtTran holds multiple records for each record in tAccount. What I am trying to do is create a query on tAccount to return the latest record in tTrans for each record in tAccount. |
|
gbritton
Master Smack Fu Yak Hacker
2780 Posts |
Posted - 2014-11-10 : 09:18:01
|
[code]select t.*from tAccounts ajoin tTrans t on a.laccount = t.laccountgroup by t.laccount, t.createdate, t. ... -- the other columns in thaving t.createdDate = max(t.createdDate)[/code] |
|
|
|
|
|