Re: [SQL] SUM the result of a subquery.

2010-09-02 Thread negora
Wow, I had no idea about this kind of SELECT _expression_. It works flawless!!! Thank you lots Jayadevan :) . On 02/09/10 14:28, Jayadevan M wrote: SELECT SUM ( (SELECT i.id_item, i.price, SUM (o.quantity), ROUND (SUM (o.quantity) * i.price, 2) AS cost FROM orders o JOIN items i ON i

Re: [SQL] SUM the result of a subquery.

2010-09-02 Thread Jayadevan M
> SELECT SUM ( > (SELECT i.id_item, i.price, SUM (o.quantity), ROUND (SUM > (o.quantity) * i.price, 2) AS cost > FROM orders o > JOIN items i ON i.id_item = o.id_item > WHERE o.date_order BETWEEN '2010-01-01' AND '2010-01-31' > GROUP BY i.id_item, i.price) > ); > > No luck. Obviously SUM expects

[SQL] SUM the result of a subquery.

2010-09-02 Thread negora
Hello: I've a question related to the combination of the SUM aggregate function and subqueries. Is it possible to SUM the resulting rows of a subquery? I'm explaining why I need this... I've a query like this: SELECT i.id_item, i.price, SUM (o.quantity), ROUND (SUM (o.quantity) * i.price, 2)

[SQL] SUM the result of a subquery.

2010-09-02 Thread negora
Hello: I've a question related to the combination of the SUM aggregate function and subqueries. Is it possible to SUM the resulting rows of a subquery? I'm explaining why I need this... I've a query like this: SELECT i.id_item, i.price, SUM (o.quantity), ROUND (SUM (o.quantity) * i.price, 2)