Gidday, > AFAIK distinct and aggregates are mutally exclusive, I don't use distinct > much > as it it of limited use and can be replicated by group by,
Yes, though they co-exist ok once I had the other issues sorted. > select O.INVNO, SUM(D.QTY) as Total > from ORDER O, DETAIL D > where O.INVNO=D.INVNO > group by O.INVNO > order by Total Won't buy total (also doesn't buy the ORDER BY SUM(D.QTY) which others have suggested -- order by 2 is fine though, per Steve's suggestion). > also you should prob use ANSI join clauses Yes, had that to start with, and still do in the original, now- working query. Was just simplifying to the max <g>. In summary, the "fixes" my original complex query definitely needed to work with IB were: * Complete list of required master fields in Group By clause, not just one or two * Order by <n>, as opposed to Order by Total or Order by Sum(...) in order to sort by the total column cheers, peter =========================================== Peter Hyde, Development Director, SPIS Ltd, Christchurch, New Zealand * TCompress/TCompLHA component sets for Delphi/Kylix/C++ * TurboNote+: http://TurboNote.com -- top-rated onscreen sticky notes Find all the above and MORE at http://spis.co.nz --------------------------------------------------------------------------- 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/
