I have 1 table called T_WWPS_1_Daily_Values' with 3 columns ('Date', 'COL1', 'COL2').
What i want to do is generate a report of the Pump Runtimes. Everything works fine except - if, as seen below, there are 2 readings for the same day,
Month Day Year Date Pump 1 Daily Runtime Pump 2 Daily Runtime
7 1 2006 7/1/2006 12:25:53 PM 0.10 10.20
7 5 2006 7/5/2006 2:56:26 PM 0.10 0.45
7 5 2006 7/5/2006 12:25:53 PM 7.10 10.20
I want to just display the last (12:25:53pm) reading.
So it would look like this:
Month Day Year Date Pump 1 Daily Runtime Pump 2 Daily Runtime
7 1 2006 7/1/2006 12:25:53 PM 0.10 10.20
7 5 2006 7/5/2006 2:56:26 PM
7 5 2006 7/5/2006 12:25:53 PM 0.10 10.20
I have now:
SELECT DatePart("m",T_WWPS_1_Daily_Values.Date) AS [Month], DatePart("d",T_WWPS_1_Daily_Values.Date) AS [Day], DatePart("yyyy",T_WWPS_1_Daily_Values.Date) AS [Year], T_WWPS_1_Daily_Values.Date, T_WWPS_1_Daily_Values.COL1, T_WWPS_1_Daily_Values.COL2, [COL1]+[COL2] AS [PS1 RunTime Total]
FROM T_WWPS_1_Daily_Values
WHERE (((DatePart("m",T_WWPS_1_Daily_Values.Date))=Forms!F_Main!hidMonth) And ((DatePart("yyyy",T_WWPS_1_Daily_Values.Date))=Forms!F_Main!hidYear))
ORDER BY DatePart("d",T_WWPS_1_Daily_Values.Date);
I tried changing the select line to add the max function: max(DatePart("d",T_WWPS_1_Daily_Values.Date)) AS [Day]
but i keep getting the "You tried to execute a query that does not include the specified expression 'DatePart("m",T_WWPS_1_Daily_Values.Date)' as part of an aggregate function???
Any ideas -thoughts would be greatly appreciated,
Steve
What i want to do is generate a report of the Pump Runtimes. Everything works fine except - if, as seen below, there are 2 readings for the same day,
Month Day Year Date Pump 1 Daily Runtime Pump 2 Daily Runtime
7 1 2006 7/1/2006 12:25:53 PM 0.10 10.20
7 5 2006 7/5/2006 2:56:26 PM 0.10 0.45
7 5 2006 7/5/2006 12:25:53 PM 7.10 10.20
I want to just display the last (12:25:53pm) reading.
So it would look like this:
Month Day Year Date Pump 1 Daily Runtime Pump 2 Daily Runtime
7 1 2006 7/1/2006 12:25:53 PM 0.10 10.20
7 5 2006 7/5/2006 2:56:26 PM
7 5 2006 7/5/2006 12:25:53 PM 0.10 10.20
I have now:
SELECT DatePart("m",T_WWPS_1_Daily_Values.Date) AS [Month], DatePart("d",T_WWPS_1_Daily_Values.Date) AS [Day], DatePart("yyyy",T_WWPS_1_Daily_Values.Date) AS [Year], T_WWPS_1_Daily_Values.Date, T_WWPS_1_Daily_Values.COL1, T_WWPS_1_Daily_Values.COL2, [COL1]+[COL2] AS [PS1 RunTime Total]
FROM T_WWPS_1_Daily_Values
WHERE (((DatePart("m",T_WWPS_1_Daily_Values.Date))=Forms!F_Main!hidMonth) And ((DatePart("yyyy",T_WWPS_1_Daily_Values.Date))=Forms!F_Main!hidYear))
ORDER BY DatePart("d",T_WWPS_1_Daily_Values.Date);
I tried changing the select line to add the max function: max(DatePart("d",T_WWPS_1_Daily_Values.Date)) AS [Day]
but i keep getting the "You tried to execute a query that does not include the specified expression 'DatePart("m",T_WWPS_1_Daily_Values.Date)' as part of an aggregate function???
Any ideas -thoughts would be greatly appreciated,
Steve