Using SUM and GROUP BY



Hi,

I have a table that stores hours, minutes, seconds and quantity. I can
find the quantity per hour by selecting hours and quantity and group by
hours with a sum for the quantity.
However if I want minutes I need to multiply the hours by 60
and add them to the minutes and then find the sum of the quantity. I
have tried the following sql statement.

SELECT Sum((hours*60)+minutes) AS mins, Sum(quantity) AS quant FROM
table1GROUP BY mins;

but keep getting this error

ERROR: java.sql.SQLException: [Microsoft][ODBC Microsoft Access Driver]
Too few parameters. Expected 1.

I've been playing around with it for a while, but get that message each
time.

Could someone point out where I am going wrong?

Thanks.

Ben.

.



Relevant Pages

  • Re: Adding Time over 24 hours
    ... To get the sum of the times, create a calculated field in the query to get ... Going back to your original query: ... You'll need to make sure that the Hours & Mins fields are in the query ...
    (comp.databases.ms-access)
  • Re: Advise needed to write a script
    ... I need your advice to wrte a script ... > 1) stores the sum of A plus B in variable C ...
    (freebsd-questions)
  • Re: Summing Time Data
    ... SUM() ignores text, while the + operator will coerce its text arguments ... Try coercing your data to actual numeric values (which is how XL stores ... values, choosing Edit/Paste Special, selecting the Values and Add radio ...
    (microsoft.public.excel.misc)
  • Re: Best way to insert rows
    ... to sum to the last row with a number ... Microsoft MVP Excel ... "John Google" wrote in message ... I can enter the rows OK by selecting 4 rows from A5 to A8 then ...
    (microsoft.public.excel.misc)
  • Re: Sum not working
    ... selecting the Values and Add radio buttons. ... > the Sum function to give me a total of quantities for ... > these formulas but the sum is giving me a zero. ... > even though the error checker says it is not it still ...
    (microsoft.public.excel.worksheet.functions)