×
The internal search function is temporarily non-functional. The current search engine is no longer viable and we are researching alternatives.
As a stop gap measure, we are using Google's custom search engine service.
If you know of an easy to use, open source, search engine ... please contact support@midrange.com.
Sorting by derived columns often necessitates a Common Table Expression or
CTE, or, change
C+ (Case When :WKSTARDSC = 'OVERALL AVERAGE' Then A1
to
C+ (Case When :WKSTARDSC = 'OVERALL AVERAGE' Then 3
And the 3 will be the third column in the selection. I prefer CTE's in
case someone adds a new selection field. Then it's more documenting then
positional.
If we trim this down to:
C/exec sql
C+ DECLARE R2CSR CURSOR FOR
C+
C+ SELECT MPMRS, CLSUPR, ROUND(AVG(NULLIF(A1,0)),0) AS A1,
C+ ROUND(AVG(NULLIF(A2,0)),0) AS A2, ROUND(AVG(NULLIF(A3,0)),0) AS A3,
C+ ROUND(AVG(NULLIF(A4,0)),0) As A4, ROUND(AVG(NULLIF(A5,0)),0) AS A5
C+
...
C+
C+ Group By mpMrs,CLSUPR
C+ ORDER BY
C+ (Case When :WKSTARDSC = 'OVERALL AVERAGE' Then A1
C+ When :WKSTARDSC = 'i5 SCREEN TIME' Then A2
C+ When :WKSTARDSC = '# OF ACCOUNTS ATTEMPTED' Then A3
C+ When :WKSTARDSC = '# OF TOTAL INSTRUMENTS' Then A4
C+ When :WKSTARDSC = '# OF SCREENS COMPLETED' Then A5 End) DESC
C/end-exec
Rob Berendt
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.