Ramco Ramco

Ramco Ramco

  • 436
  • 3.4k
  • 555.6k

Incorrect Syntax near Union

Jan 7 2025 4:53 AM

Hi

  In below code i am getting error Incorrect Syntax near Union

SELECT v_opgDebit,v_opgCredit,'' AS "CardCode",'' AS "CardName",'' As "Branch", '' AS "DocNo", '' as "DocDate",
'' as "Remarks",v_opgDebit As "Debit", v_opgCredit As "Credit" 

Union All 

SELECT v_opgDebit,v_opgCredit,T3."ShortName" AS "CardCode",(Select Max("CardName") from OCRD where "CardCode" = T3."ShortName") AS "CardName",T3."BPLName" As "Branch", T2."BaseRef" AS "DocNo", T2."TaxDate" as "DocDate",
T3."LineMemo" as "Remarks",T3."Debit" As "Debit", T3."Credit" As "Credit" 
FROM "OJDT"  T2 INNER JOIN JDT1 T3 ON T2."TransId" = T3."TransId" WHERE 
 (T3."ShortName"=:BpCode)
)

Thanks


Answers (3)