Have you tried adding Total into the group by?
JED
[EMAIL PROTECTED] wrote on 21/07/2003 02:34:13 PM:
> Hi folks,
> Can anyone spot why this dirt-simple Interbase SQL is rejected with
> an invalid column reference UNLESS I remove all of the SUM, GROUP and
> ORDER clauses:
>
> select distinct O.INVNO, SUM(D.QTY) as Total
> from ORDER O, DETAIL D
> where O.INVNO=D.INVNO
> group by O.INVNO
> order by Total
>
> All I'm trying to do is return a result set which contains relevant
> fields from a master table, plus a Total field obtained by summing
> matching rows of a detail table. Bread and butter SQL, but today I'm
> missing something very obvious.
>
This email and any files transmitted with it are confidential and
intended solely for the use of the individual or entity to whom they
are addressed. If you have received this email in error please notify
the [EMAIL PROTECTED]
---------------------------------------------------------------------------
New Zealand Delphi Users group - Delphi List - [EMAIL PROTECTED]
Website: http://www.delphi.org.nz
To UnSub, send email to: [EMAIL PROTECTED]
with body of "unsubscribe delphi"
Web Archive at: http://www.mail-archive.com/delphi%40delphi.org.nz/