Mike,
Consider my example shown below.
I want one row for each Region and Employee
I pass two parameters (begin and End date)to the compiled QMQRY object
I ORDER BY the same fields as the GROUP BY

SELECT TDAC05,EMPLOYEE,SDADDJ,SDDOCO,SDDCTO,SDAN8,
SUM(CASE WHEN SDSRP1='HDW' THEN SDAEXP * 0.01 ELSE 0 END)
AS WoodGateHdw,
SUM(CASE WHEN SDSRP1='HDW' THEN TD$PXP ELSE 0 END)
AS WoodGateHdw_Profit
FROM F42119J9 WHERE SDADDJ BETWEEN &BEGIN AND &END

GROUP BY
TDAC05,EMPLOYEE,SDADDJ,SDDOCO,SDDCTO,SDADDJ,SDDOCO,SDDCTO,SDAN8
ORDER BY
TDAC05,EMPLOYEE,SDADDJ,SDDOCO,SDDCTO,SDADDJ,SDDOCO,SDDCTO,SDAN8


STRQMQRY QMQRY(J55PROFN ) OUTPUT(*OUTFILE) +
OUTFILE(AMSDTA/F55PROFN ) SETVAR((BEGIN +
&PSOPT1 ) (END &PSOPT2 ))


This thread ...


Follow On AppleNews
Return to Archive home page | Return to MIDRANGE.COM home page

This mailing list archive is Copyright 1997-2019 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].