Skip to Content
Former Member
Mar 23, 2010 at 11:36 PM

SQL Command to select MAX(date) & Max(time)


My am having a really hard time getting a sql command to return data with the max(date) & max(time) combination. I think I need a sub query but can not figure it out. I have looked all over the internet but still don't understand it. Below is my command which returns the max date & max time but they are not from the same row of data. Please help.

SELECT "labor"."order-no", "labor"."oper-no", MAX("labor"."end-date") AS myDate, Max("labor"."end-time") AS myTime

FROM "E940LIVE"."PUB"."tm-log" "labor"

WHERE "labor"."order-no"='73153-bc' AND "labor"."company"='01'

GROUP BY "labor"."order-no", "labor"."oper-no"