I am hoping I can get some help with a query I am trying to construct:

I want to group by a 'contract' column and get the sum of the 'amlp' column
values associated with each contract. I can do a select and group by on
contract 

select contract from maintenance group by contract;

and I will get each unique contract. However, I want to sum the amlp values
per unique contract and I am not sure how to construct that select
statement. 

I tried:

select contract , sum(amlp) from maintenance where contract=(select contract
from maintenance group by contract);

But that resulted in a "ERROR 1242 (21000): Subquery returns more than 1
row" error.

Any suggestions?

Hagen Finley

Boulder



-- 
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:    http://lists.mysql.com/mysql?unsub=arch...@jab.org

Reply via email to