On Saturday, January 27, 2007, 6:09:59 PM, Trey Mack
wrote:
>> 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?
> Use a subquery
>
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?
Use a subquery
SELECT price, sum(count) FROM (
-- your original query here
SELECT price, count FROM ... WHERE
On Saturday, January 27, 2007, 4:59:49 PM, Igor
Tandetnik 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
[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 matches
Mail list logo