Subject Re: [firebird-support] SQL headache
Author Arno Brinkman
Hi,

> I've been coming to that conclusion, to make matters worse I need a
> generic solution as the number of sol records is indefinate (my example
> had 3 but it could be 300)

I didn't test my query, but it should work with any number of different items in the order. And you
should swap the GROUP BY and HAVING clauses i wrote them in the wrong order. The whole
SalesOrderLines need to be scanned anyway and the lookups (sub-queries can probably benefit from the
cache).

Regards,
Arno Brinkman
ABVisie

-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
Firebird open source database (based on IB-OE) with many SQL-99 features :
http://www.firebirdsql.org
http://www.firebirdsql.info
http://www.fingerbird.de/
http://www.comunidade-firebird.org/

Support list for Interbase and Firebird users :
firebird-support@yahoogroups.com

Nederlandse firebird nieuwsgroep :
news://newsgroups.firebirdsql.info