Can someone please help me with this query.
zoneID, flyingObjectID and DateAndTime make up a composite key for my table FlyingObjects
I need to get the rows: for each zone all the flying objects associated with it (once), where the DateAndTime is MAX(DateAndTime)
so far I got:
SELECT zoneID, flyingObjectID, MAX(DateAndTime)
FROM FlyingObjects
GROUP BY zoneID, flyingObjectID
ORDER BY zoneID MAX(DateAndTime) desc
This is fine and it works well. However the information I need to select is not just zoneID, flyingObjectID and MAX(DateAndTime)
but also all other columns in the rows
like positionX, positionY, positionZ
I have been trying to use IN and EXISTS and use
the above SQL as a subquery, but it won't work.
Any help appreticated
Marika
zoneID, flyingObjectID and DateAndTime make up a composite key for my table FlyingObjects
I need to get the rows: for each zone all the flying objects associated with it (once), where the DateAndTime is MAX(DateAndTime)
so far I got:
SELECT zoneID, flyingObjectID, MAX(DateAndTime)
FROM FlyingObjects
GROUP BY zoneID, flyingObjectID
ORDER BY zoneID MAX(DateAndTime) desc
This is fine and it works well. However the information I need to select is not just zoneID, flyingObjectID and MAX(DateAndTime)
but also all other columns in the rows
like positionX, positionY, positionZ
I have been trying to use IN and EXISTS and use
the above SQL as a subquery, but it won't work.
Any help appreticated
Marika