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 |
craigmacca2424
Starting Member
1 Post |
Posted - 2014-08-26 : 20:49:14
|
Hi, I have a parent to child table, (Id, ParentId, DateModified)i need to calculate the max DateModified for any of the children, as belowId, ParentId, DateModified, CaluclatedDateModified1, 0, 01/01/2014, 04/01/20142, 1, 01/01/2014, 04/01/20143, 1, 01/01/2014, null --no children4, 2, 02/01/2014, 04/01/20145, 4, 03/01/2014, 04/01/20146, 5, 04/01/2014, null --no children |
|
gbritton
Master Smack Fu Yak Hacker
2780 Posts |
Posted - 2014-08-27 : 08:36:48
|
[code]select parent.Id, child.ParentId, max(child.DateModified)from parentjoin child on parent.Id = child.ParentIdgroup by parent.Id, child.ParentId[/code][/code] |
|
|
|
|
|
|
|