On Saturday, January 27, 2007, 4:59:49 PM, Igor 
Tandetnik<sqlite-users@sqlite.org> wrote:
> [EMAIL PROTECTED] wrote:
>> I've got a query, let's say query "A" which returns data in the
>> following form:
>> 
>> price | count
>> 3       5
>> 3       8
>> 4       2
>> 4       9
>> 4       12
>> 6       10
>> 
>> What I want to do is get unique prices and sum the count of the
>> duplicates, so it gets
>> 
>> price | count
>> 3       13
>> 4       23
>> 6       10

> select price, sum(count)
> from ... where ...
> group by price;

> Igor Tandetnik

> -----------------------------------------------------------------------------
> To unsubscribe, send email to [EMAIL PROTECTED]
> -----------------------------------------------------------------------------

Actually, my query is something like
SELECT ... FROM ... WHERE `pid` = (SELECT `id` FROM ...);
if i put that group by... will it group all rows, or only those with
the same pid?

Best Regards,
Ivailo Karamanolev


-----------------------------------------------------------------------------
To unsubscribe, send email to [EMAIL PROTECTED]
-----------------------------------------------------------------------------

Reply via email to