Microsoft
Software
Hardware
Network
Question : Sql query
I have 2 tables.
tblContacts
ID
Name
LastMessageDate
tblMessages
ID
Message
ContactRef
RecvdDate
Each contact may have many messages. I just added the LastMessageDate field to the Contact table. I want to update it with the most recently recieved message for each contact, as recorded in the tblMessage table.
How can I write a query to do this?
Answer : Sql query
update tblContacts
set LastMessageDate = M.Lmd
from tblContacts C
inner join (select Id, max(LastMessageDate) as LMD from tblMessages group by Id) M
on c.Id = M.Id
Random Solutions
Making Excel 2007 the default program (Rather then Excel 2003)
bypass delete verification
C drive is filling up with Live Update Downloads
calling stored procedure from function generates error
Disable Win XP auto-created printer from being auto-created by Citrix
modify cangrow property dynamically
Basic Question: how to get to VBA for Report Open Event
DECLARE_DYNCREATE and protected constructor
Digging in to somebody else's stuff
Interrupt windowsw startup for installtion tasks