Subject | Re: [ib-support] group by doesn't work |
---|---|
Author | Helen Borrie |
Post date | 2002-01-06T23:37:17Z |
At 07:55 PM 06-01-02 +0000, Gunter wrote:
GROUP BY is for grouping aggregations, so all of the columns in the output need to be involved in the aggregation. Typically, you would be asking for a SUM(), MAX(), MIN() or COUNT() of the rows being collected by the GROUP BY.
Perhaps you really wanted ORDER BY:
SELECT t1.column1,
t1J.joinColumn1,
t1j.joinColumn2
FROM table1 T1
LEFT OUTER JOIN table1join T1j
ON t1.column1=t1j.joinColumn0
WHERE t1.column1 >= 0
ORDER BY t1.column1
hth
Helen
All for Open and Open for All
Firebird Open SQL Database ยท http://firebirdsql.org
_______________________________________________________
>I tried to execute following sql statement and a get an invalidGunter,
>column reference error:
>
>SELECT table1.column1,table1join.joinColumn1,table1join.joinColumn2
>FROM table1 LEFT OUTER JOIN table1join ON
>table1.column1=table1join.joinColumn0 WHERE table1.column1 >= 0
>GROUP BY table1.column1
>
>Any suggestions? TIA
GROUP BY is for grouping aggregations, so all of the columns in the output need to be involved in the aggregation. Typically, you would be asking for a SUM(), MAX(), MIN() or COUNT() of the rows being collected by the GROUP BY.
Perhaps you really wanted ORDER BY:
SELECT t1.column1,
t1J.joinColumn1,
t1j.joinColumn2
FROM table1 T1
LEFT OUTER JOIN table1join T1j
ON t1.column1=t1j.joinColumn0
WHERE t1.column1 >= 0
ORDER BY t1.column1
hth
Helen
All for Open and Open for All
Firebird Open SQL Database ยท http://firebirdsql.org
_______________________________________________________