Say I have parent->child tables setup. Call them
Is there anyway to create an Indexed view that will have the PK of the parent (ShipmentId) and the created when of the newest child (Widget.CreatedWhen).
This is the query I am looking for:
SELECT widg.ShipmentId, MAX(widg.CreatedWhen) NewestWidget FROM dbo.Widget widg GROUP BY widg.ShipmentId
Obviously this query cannot be an Indexed View because it has
MAX in it.
But is there some other way via "Indexed View Legal" SQL to get a similar result set?