I need assistanace in combining this SQL Statement.
SELECT Transaction_DateTimestamp, Total_Hours, Date1, Employee_Name, Travel_Time from GrooveImports where Date1 >= '4/5/2012' and Date1 <= '4/8/2012' and Employee_Name = 'XYZ'
produces a list of employee dates and times with each record having a date timestamp of when the record was last modified. However, SQL A also retrieves ALL records between those dates, where I need to only return the MAX (DateTimestamp) of each day, so only the latest modified record is returned.
When I use the below statement for 1 day, this returns the latest record for that day.
So my question, is how can I return the latest record for each day when given a date range? (I am thinking it is a union, and/ or creating a temp table, but I am not the expert)
SELECT Transaction_DateTimestamp, Total_Hours, Date1, Employee_Name, Travel_Time from GrooveImports where Date1= '4/5/2012' AND (GrooveImports.Transaction_DateTimeStamp =
(SELECT MAX(Transaction_DateTimeStamp) AS Expr1
FROM GrooveImports AS GrooveImports_1
WHERE (Date1 = '4/4/2012')))