|
Many thanks for all the replies. The result I was looking for is one single number (therefore no group by/order by clauses) which basically is the number of transaction records divided by the number of customer records giving the average number of transactions per customers. The statement sent by Eric DeLong (which put into practice the theory of Joe Pluta) seems to fit my requirements exactly. I would've never thought of that trick! Thanks! Btw, the qmquery manager does not allow nested functions, eg. avg(count(field)). Is this a limitation that does not exist with the full blown SQL LPP? Best regards, Matthias > > How about this (run against order hdr/dtl files): > > SELECT (COUNT(DISTINCT char(B.ODORD#)||char(B.ODOELN)) / > COUNT(DISTINCT A.OHORD#)) > FROM oepordh a left outer join oepordd b on A.OHORD#=B.ODORD# > > The trick is to make sure the numerator (in my case, the order number||Order > line#) is a unique value. The distinct keyword removes duplicate entries, so > make sure you account for that. > -- -------------------------------------------------- Matthias Oertli matthias.oertli@mdi.com.au
As an Amazon Associate we earn from qualifying purchases.
This mailing list archive is Copyright 1997-2024 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].
Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.