Hi
In below code i am getting error
ELECT 'a' AS "Vendor Code",'b' AS "Vendor Name",'b','d', 'e', 'Opening Balance',v_opgDebit,v_opgCredit
Union All
SELECT T2."CardCode" AS "Vendor Code",T2."CardName" AS "Vendor Name",T2."BPLName",T2."DocNum", T2."DocDate", 'A/p Invoice',0,(T2."DocTotal") + (T2."DpmAmnt") + (T2."DpmVat")
FROM "OPCH" T2
WHERE T2."DocDate" >= TO_DATE(:FromDate) and T2."DocDate" <= TO_DATE(:ToDate)
AND (T2."CardCode"=:BpCode )
Thanks
Jaimin ShethiyaPosted Jan 3, 2025, 10:37 AM
Hello Ramco,
You have not mentioned a proper alias name.
If you are trying to use union and union all at that time, you should provide the proper alias name so SQL is aware of the columns and, based on that, generate the result and show it in the result window.
Please use below query
Jignesh KumarPosted Jan 3, 2025, 8:58 AM
Your alias name miss matches in all three select statements, Please check the same column name for all select statements
Ramco RamcoPosted Jan 3, 2025, 8:37 AM
Hi Jignesh
I have writtten below code but it is giving error Incorrect Syntax near Union
Thanks
Jignesh KumarPosted Jan 3, 2025, 8:33 AM
Hello Ramco,
You need to give n alias to the last two columns, and assign 0 as the default values
Ramco RamcoPosted Jan 3, 2025, 8:29 AM
Hi jignesh
What is wrong in this below select
SELECT 'a' AS "Vendor Code",'b' AS "Vendor Name",'b','d', 'e', 'Opening Balance',v_opgDebit,v_opgCredit
Union All
Thanks
Jignesh KumarPosted Jan 3, 2025, 8:10 AM
Then you can put some default values for that
Ramco RamcoPosted Jan 3, 2025, 7:43 AM
Hi Jignesh
First select statement data is not from any table
Thanks
Jignesh KumarPosted Jan 3, 2025, 7:40 AM
Hello Ramco,
Please make your query more readable and consistent naming convension for columns will help to maintain quarey,