Image 006.png
i'm running a (quite complex) query that i have prepared on Dbeaver, and runs there without ant issues..
also tried it with interactive sql - and no problems
when asking the preview in the datasource i get the following error as in picture
The sql i'm executing is the following
i'm running a (quite complex) query that i have prepared on Dbeaver, and runs there without ant issues..
also tried it with interactive sql - and no problems
when asking the preview in the datasource i get the following error as in picture
The sql i'm executing is the following
PHP Code:
WITH WHAF (wcsite, wnartk, wnklnt, wDlevr, wqafrp) as
(SELECT 'TLT', afnartk, afnklnt,
last_day(afdlevr),
sum(afqafrp)
FROM codat/cohafpf
WHERE afdlevr>='2020-01-01'
GROUP BY afnartk, afnklnt, Last_day(afdlevr)
UNION
SELECT 'BUD', afnartk, afnklnt,
last_day(afdlevr),
sum(afqafrp)
FROM codathu/cohafpf
WHERE afdlevr>='2020-01-01'
GROUP BY afnartk, afnklnt, Last_day(afdlevr)),
WBTG (w2csite, w2ntool, w2qvcys ) as
(SELECT 'TLT', vwntool, max(vwqvcys)
FROM codat/COBTGV1
GROUP BY vwntool
UNION
SELECT 'BUD', vwntool, max(vwqvcys)
FROM codathu/COBTGV1
GROUP BY vwntool
)
SELECT wcsite,
cxbrcm CONCAT ' ' CONCAT Substr(BUDG.ptxpraw, 1, 30) as Budgetkl,
wnklnt, cxcunm,
wDlevr,
wnartk, CASE WHEN arxarkl IS NULL THEN arvlab ELSE arxarkl END AS Description,
CASE WHEN arxaprt IS NULL THEN 'N/A' ELSE arxaprt END AS pARTNBR,
CASE WHEN arntool IS NULL THEN 0 else arntool END AS TOOL,
CASE WHEN tlxtool IS NULL THEN 'N/A' ELSE tlxtool END TOOLTEXT,
wqafrp,
coud04rsit('TLT', wnklnt, wnartk, wdlevr, date('0001-01-01'), date('0001-01-01'), 0, 0) AS Price,
CASE WHEN w2qvcys IS NULL THEN 0 ELSE w2qvcys END AS MAx_CycleTime
FROM whaf LEFT OUTER JOIN codat/cobarpf ON
arnartk = wnartk
LEFT OUTER JOIN pudat/OBABAR ON
bedrab=1 AND arnrab = char(wnartk)
LEFT OUTER JOIN codat/cxx ON
cxcuno = wnklnt
LEFT OUTER JOIN cobtlpf ON
TLNTOOL= arntool
Left outer join codat/cotptpf BUDG on
Budg.ptcparm = 'BUDGETKL' and Budg.ptcprsl = digits(cxbrcm)
LEFT OUTER JOIN WBTG ON
w2csite='TLT' AND w2ntool=arntool
WHERE wcsite='TLT'
UNION
SELECT wcsite,
cxbrcm CONCAT ' ' CONCAT Substr(BUDG.ptxpraw, 1, 30) as Budgetkl,
wnklnt, cxcunm,
wDlevr,
wnartk, CASE WHEN arxarkl IS NULL THEN arvlab ELSE arxarkl END AS Description,
CASE WHEN arxaprt IS NULL THEN 'N/A' ELSE arxaprt END AS pARTNBR,
CASE WHEN arntool IS NULL THEN 0 else arntool END AS TOOL,
CASE WHEN tlxtool IS NULL THEN 'N/A' ELSE tlxtool END TOOLTEXT,
wqafrp,
coud04rsit('BUD', wnklnt, wnartk, wdlevr, date('0001-01-01'), date('0001-01-01'), 0, 0) AS Price,
CASE WHEN w2qvcys IS NULL THEN 0 ELSE w2qvcys END AS MAx_CycleTime
FROM whaf LEFT OUTER JOIN codathu/cobarpf ON
arnartk = wnartk
LEFT OUTER JOIN pudat.OBABAR ON
bedrab=1 AND arnrab = char(wnartk)
LEFT OUTER JOIN codathu.cxx ON
cxcuno = wnklnt
LEFT OUTER JOIN cobtlpf ON
TLNTOOL= arntool
Left outer join codathu/cotptpf BUDG on
Budg.ptcparm = 'BUDGETKL' and Budg.ptcprsl = digits(cxbrcm)
LEFT OUTER JOIN WBTG ON
w2csite='BUD' AND w2ntool=arntool
WHERE wcsite='BUD'
ORDER BY 1, 2, 3, 5, 4

Comment