× 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.



I had thought of it and no dice.  Numeric ORDER BY does not seem to make a
difference.  Sorry, I should have
said what I'd already tried.  I also tried commenting out the summation
(CFTLVL+CFPLVL), and this did not seem to affect the overall sort.





>With UNIONs, I would change my ORDER BY clause to use the numeric
placement
>of the field you want to order by - in your example below - "ORDER BY 3".

>Dave


SQL statement:

DECLARE CURS1 CURSOR FOR
 WITH BTAB AS
   (SELECT *
      FROM ITHL01 LEFT OUTER JOIN CMF2L01
      ON CFPROD=TPROD AND CFFAC=:WMFAC
      WHERE TTYPE='B' AND
        TWHS='02' AND
        TTDTE>=:FromDate AND TTDTE<=:ToDate),
 HTAB AS
    (SELECT *
      FROM ITHL01 LEFT OUTER JOIN CMF2L01
      ON CFPROD=TPROD AND CFFAC=:WMFAC
      WHERE TTYPE='H' AND
        TWHS<>'02' AND
        TTDTE>=:FromDate AND TTDTE<=:ToDate)
 SELECT F1.TTYPE, F1.TWHS, F1.TPROD, F1.TQTY, F1.TSCST, F1.TTDTE
   FROM BTAB F1 EXCEPTION JOIN HTAB F2
   ON F1.TPROD=F2.TPROD AND
     F1.TQTY=F2.TQTY*(-1) AND
     F1.TSCST=F2.TSCST AND
     (F1.CFTLVL+F1.CFPLVL)=(F2.CFTLVL+F2.CFPLVL)
 UNION
 SELECT F3.TTYPE, F3.TWHS, F3.TPROD, F3.TQTY, F3.TSCST, F3.TTDTE
   FROM HTAB F3 EXCEPTION JOIN BTAB F4
   ON F3.TPROD=F4.TPROD AND
     F3.TQTY=F4.TQTY*(-1) AND
     F3.TSCST=F4.TSCST AND
     (F3.CFTLVL+F3.CFPLVL)=(F4.CFTLVL+F4.CFPLVL)
 ORDER BY TPROD




_______________________________________________
This is the Midrange Systems Technical Discussion (MIDRANGE-L) mailing list
To post a message email: MIDRANGE-L@midrange.com
To subscribe, unsubscribe, or change list options,
visit: http://lists.midrange.com/cgi-bin/listinfo/midrange-l
or email: MIDRANGE-L-request@midrange.com
Before posting, please take a moment to review the archives
at http://archive.midrange.com/midrange-l.
_______________________________________________
This is the Midrange Systems Technical Discussion (MIDRANGE-L) mailing list
To post a message email: MIDRANGE-L@midrange.com
To subscribe, unsubscribe, or change list options,
visit: http://lists.midrange.com/cgi-bin/listinfo/midrange-l
or email: MIDRANGE-L-request@midrange.com
Before posting, please take a moment to review the archives
at http://archive.midrange.com/midrange-l.







As an Amazon Associate we earn from qualifying purchases.

This thread ...


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

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.