Skip to Content
0
Sep 09, 2018 at 02:41 AM

SQL UNION ALL QUERY ERROR

590 Views

Hi, I am trying to run a SQL query using Union All but it throws an error,

however. while running the same as standalone it works very well.. could you please find the problem in my below query.

SELECT

T0."DocNum", T0."DocDate", T0."CardCode", T0."CardName", T1."ItemCode", T1."Dscription", T1."Quantity", T1."LineTotal"

FROM OINV T0 INNER JOIN INV1 T1 ON T0."DocEntry" = T1."DocEntry" INNER JOIN OCRD T2 ON T0."CardCode" = T2."CardCode"

WHERE

"DocDate" between [%1] and [%2] and T0."CANCELED" =[%0]

UNION ALL

SELECT

T0."DocNum", T0."DocDate", T0."CardCode", T0."CardName", T1."ItemCode", T1."Dscription", T1."Quantity", T1."LineTotal"

FROM ORIN T0 INNER JOIN RIN1 T1 ON T0."DocEntry" = T1."DocEntry" INNER JOIN OCRD T2 ON T0."CardCode" = T2."CardCode"

WHERE T0."DocDate" between [%1] and [%2] and T0."CANCELED"=[%0]

Error reported:

260 Invalid column name : N : line 1 Col 369 " (SWEI) (At Pos 368)