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



this is rest. I posted until that statement bec. that is where it stops
working, the prev part is working.

FROM RLIB.OEORD1
WHERE ODPRLC = 'ENG'
AND substr(odprt#,1,5) <> 'NOENG'
AND ODORD# in(SELECT TSORD#
FROM DLIB.Ordheadr,DLIB.TRNSTAT2,DLIB.TRA11
WHERE OHCOM# = TSCOM# AND OHORD# = TSORD#
AND (otCOM# = OHCOM# AND OTORD#= OHORD# AND ottrnc = 'AQC')
AND OHORDT IN('RTR','INT','SAM')
AND OHREQD = replace(char(current date, iso), '-', '')
AND OHHLDC = ' '
AND
((TSSTAT IN('AEP','SPJ')
AND OHORD# NOT in(SELECT a.TSORD# FROM DLIB.TRNSTAT2 a
WHERE a.tsstat IN('EEP','SPC')))
OR
TSSTAT IN('EEP','SPC') AND
OHORD# IN (SELECT DISTINCT(C.TSORD#) FROM DLIB.TRNSTAT2 C
INNER JOIN (
SELECT DISTINCT(B.TSORD#), MAX(B.TSUTIM) AS C_TSUTIM,MAX(B.TSUDAT) AS
C_TSUDAT FROM DLIB.TRNSTAT2 B
WHERE B.TSSTAT IN ('EEP','SPC','ECM','ECT','ECA','CEL','BOC','COM',
'COO','REV','MCO','CPA','ECV','ECC','EPT','EPM',
'CAT','CAC','CAM','CAS','MAC','004','006','600','MEP','EPC','CPK')
GROUP BY B.TSORD#
) q1
ON C.TSORD# = q1.TSORD# AND C.TSUDAT = q1.C_TSUDAT AND C.TSUTIM =
q1.C_TSUTIM
WHERE C.TSORD# NOT IN(
SELECT F.TSORD# FROM DLIB.TRNSTAT2 F
WHERE F.tsstat
IN('SPJ','REL','EAS','REV','STP','SPT','PPC','SPM','BPA','BPB','BPC','BPD','BPE',
'BPF','BPG','BPH','BPI','BPJ','BPK','BPL','BPM','BPN','CBM','BPO','BPP','BAT','BCM',
'BAM','WAT','WAM','LBL','012','006','600','004','SCP','CBA','CBB','CBC','CBD','CBE',
'CBF','CBG','CBH','CBI','CBJ','CBK','CBL','CBM','CBN','CBO','CBP','CBQ','CBR','CBS',
'CBT','CBU','CBV','CBW','CBX','CBY','CBZ','CB1','CB2','CB3','CB4', 'CB5'))
AND C.TSSTAT IN('EEP','SPC'))
))


On Wed, Nov 12, 2014 at 12:40 PM, Birgitta Hauser <Hauser@xxxxxxxxxxxxxxx>
wrote:

SELECT COALESCE(SUM(OdQty#),0)
from WHAT???

Mit freundlichen Grüßen / Best regards

Birgitta Hauser

"Shoot for the moon, even if you miss, you'll land among the stars." (Les
Brown)
"If you think education is expensive, try ignorance." (Derek Bok)
"What is worse than training your staff and losing them? Not training them
and keeping them!"

-----Ursprüngliche Nachricht-----
Von: MIDRANGE-L [mailto:midrange-l-bounces@xxxxxxxxxxxx] Im Auftrag von
Hoteltravelfundotcom
Gesendet: Wednesday, 12.11 2014 17:48
An: Midrange Systems Technical Discussion
Betreff: error in sql

the following sql code works up until the last statement (Select
Coalesce(SUM(OdQty#),0) then it gives this message:

'SQL0199 Keyword Select Not Selected. Valid Tokens: For Use Skip Wait With
Fetch Order Union Except Optimize' can you explain this issue to me?

SELECT COUNT(*)
FROM DLIB.ORDHEADR,DLIB.TRANCODE,DLIB.TRA11
WHERE OHCOM# = TSCOM# AND OHORD# = TSORD# AND (otCOM# = OHCOM# AND OTORD#=
OHORD# AND ottrnc = 'AQC') AND OHORDT IN('RTR','INT','SAM') AND OHREQD =
replace(char(current date, iso), '-', '') AND OHHLDC = ' '
AND
((TSTATS IN('AEP','SPJ')
AND OHORD# NOT in(SELECT a.TSORD# FROM DLIB.TRANCODE a WHERE a.TSTATS
IN('EEP','SPC'))) OR TSTATS IN('EEP','SPC') AND OHORD# IN (SELECT
DISTINCT(C.TSORD#) FROM DLIB.TRANCODE C INNER JOIN ( SELECT
DISTINCT(B.TSORD#), MAX(B.TSUTIM) AS C_TSUTIM,MAX(B.TSUDAT) AS C_TSUDAT
FROM
DLIB.TRANCODE B WHERE B.TSTATS IN
('EEP','SPC','ECM','ECT','ECA','CEL','BOC','COM',
'COO','REV','MCO','CPA','ECV','ECC','EPT','EPM',
'CAT','CAC','CAM','CAS','MAC','004','006','600','MEP','EPC','CPK')
GROUP BY B.TSORD#
) q1
ON C.TSORD# = q1.TSORD# AND C.TSUDAT = q1.C_TSUDAT AND C.TSUTIM =
q1.C_TSUTIM WHERE C.TSORD# NOT IN( SELECT F.TSORD# FROM DLIB.TRANCODE F
WHERE F.TSTATS

IN('SPJ','REL','EAS','REV','STP','SPT','PPC','SPM','BPA','BPB','BPC','BPD','
BPE',

'BPF','BPG','BPH','BPI','BPJ','BPK','BPL','BPM','BPN','CBM','BPO','BPP','BAT
','BCM',

'BAM','WAT','WAM','LBL','012','006','600','004','SCP','CBA','CBB','CBC','CBD
','CBE',

'CBF','CBG','CBH','CBI','CBJ','CBK','CBL','CBM','CBN','CBO','CBP','CBQ','CBR
','CBS',
'CBT','CBU','CBV','CBW','CBX','CBY','CBZ','CB1','CB2','CB3','CB4', 'CB5'))
AND C.TSTATS IN('EEP','SPC'))
)
SELECT COALESCE(SUM(OdQty#),0)
--
This is the Midrange Systems Technical Discussion (MIDRANGE-L) mailing list
To post a message email: MIDRANGE-L@xxxxxxxxxxxx To subscribe,
unsubscribe,
or change list options,
visit: http://lists.midrange.com/mailman/listinfo/midrange-l
or email: MIDRANGE-L-request@xxxxxxxxxxxx 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@xxxxxxxxxxxx
To subscribe, unsubscribe, or change list options,
visit: http://lists.midrange.com/mailman/listinfo/midrange-l
or email: MIDRANGE-L-request@xxxxxxxxxxxx
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 ...

Replies:

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.