Try Order By 1 (or is that 2?)

>> 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.



---------------------------------------------------------------------------
    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/

Reply via email to