DA SQL UNION

visual-studio

(brian71us) #1

I have two tables with the following SELECT statements:

SELECT [CUSTNMBR],[ITEMNMBR],[SOPNUMBE],[GLPOSTDT],[SERLTNUM],[ORIGNUMB],[CSTPONBR],[ITMSHNAM] FROM [BTEK2].[dbo].[RASearchManufacturing]
WHERE
{WHERE}

and:

SELECT [CUSTNMBR],[ITEMNMBR],[SOPNUMBE],[GLPOSTDT],[SERLTNUM],[ORIGNUMB],[CSTPONBR],[ITMSHNAM] FROM [BTEK2].[dbo].[RASearchSalesOrders]
WHERE
{WHERE}

If I execute either of these two DA SQL queries they work individually:

SELECT [CUSTNMBR],[ITEMNMBR],[SOPNUMBE],[GLPOSTDT],[SERLTNUM],[ORIGNUMB],[CSTPONBR],[ITMSHNAM] FROM [RASearchSalesOrders] WHERE SERLTNUM LIKE :SERIALNO

and:

SELECT[CUSTNMBR],[ITEMNMBR],[SOPNUMBE],[GLPOSTDT],[SERLTNUM],[ORIGNUMB],[CSTPONBR],[ITMSHNAM] FROM [RASearchManufacturing] WHERE SERLTNUM LIKE :SERIALNO

I am then able to display the results in a grid control.

If I try to do a union of these two statements as shown below then I get an exception.

SELECT [CUSTNMBR],[ITEMNMBR],[SOPNUMBE],[GLPOSTDT],[SERLTNUM],[ORIGNUMB],[CSTPONBR],[ITMSHNAM] FROM [RASearchSalesOrders] WHERE SERLTNUM LIKE :SERIALNO
UNION SELECT[CUSTNMBR],[ITEMNMBR],[SOPNUMBE],[GLPOSTDT],[SERLTNUM],[ORIGNUMB],[CSTPONBR],[ITMSHNAM] FROM [RASearchManufacturing] WHERE SERLTNUM LIKE :SERIALNO

image


(antonk) #2

UNION / UNION ALL is not supported by DA SQL atm.

I’ll log an issue to investigate this. You’ll be auto-notified on issue progress via messages in this thread.


(RemObjects) #3

Thanks, logged as bugs://82031


(brian71us) #4

Ok

I’ve set up a new “table” and put that SQL UNION into the command then used DA SQL to select from that table


(antonk) #5

Yes, that’s a workaround. I still need to investigate if it is possible to implement the UNION / UNION ALL support directly on the DA SQL level.


(RemObjects) #6

bugs://82031 got closed with status fixed.