Union of sql select statements with sc_concat doesn't work

I have a select field and before, this was the select statement and it worked

SELECT
   PartDescription, sc_concat(PartDescription, ' (Qty. ', QtyRequested, ')'); 
FROM
   po_details
WHERE 
   PurchaseOrder = "[PO]"

I changed my datatable and now i need to do this, but it doesn’t work

SELECT
   PartDescription, sc_concat(PartDescription, ' (Qty. ', QtyRequested, ')') 
FROM
   po_details
WHERE 
   PurchaseOrder = "[PO]"
UNION
SELECT
   AltPartDescription, sc_concat(AltPartDescription, ' (Qty. ', AltQtyRequested, ')') 
FROM
   po_details
WHERE 
   PurchaseOrder = "[PO]"

I tried it without sc_concat and it works, so the problem is with sc_concat i believe. any ideas how to fix this?

You can use the native concat function of the database instead and use an alias to be sure that the 2 SELECT matches

concat(PartDescription, ' (Qty. ', QtyRequested, ')' ) AS qty

Also check that PartDescription and AltPartDescription have the same format

1 Like

Hi @jlboutin60 , thanks for your quick response
I tried your solution and it works in sql builder but in my application, the select field shows up empty


image

Sorry I don’t know why it’s not transfer to your field

1 Like