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 |
|
jewel
Starting Member
18 Posts |
Posted - 2004-10-06 : 19:47:33
|
| Hi all - my last query for today lol.my query so far isSELECT FirstName, LastName, Phone, CallPrompt AS Title, Date2FROM dbo.ClientWHERE (Date2 < '2004-09-30 00:00:00')ORDER BY Date2this works fine - but I have now been asked to change it to include the last call date - which means I now need to do a join with the call table - one (Client)to many (Call)relationshipsClient (dbo) ClientCode and Call(dbo) ClientCodeIf I add from Call (dbo) the LogDatTim field - how do I tell it I only want the last date used.thanks |
|
|
Pat Phelan
Posting Yak Master
187 Posts |
Posted - 2004-10-08 : 14:00:10
|
I'd use: SELECT * FROM Call AS a WHERE a.LogDatTim = (SELECT Max(b.LogDatTim) FROM Call AS b WHERE b.ClientCode = a.ClientCode) -PatP |
 |
|
|
|
|
|