Are UNION and UNION ALL supported? I see some of t...
# suiteql
b
Are UNION and UNION ALL supported? I see some of the examples here use UNION, but they don't make any sense to me. They are all UNION'ing two of the same exact query together. I also tried them, and SuiteScript says "Unexpected Error" or "Search error occurred: Invalid or unsupported search". https://docs.oracle.com/en/cloud/saas/netsuite/ns-online-help/section_156257790831.html
Copy code
SELECT * FROM transaction UNION SELECT * FROM transaction
Copy code
SELECT TOP 1 id FROM transaction UNION SELECT TOP 1 id FROM transaction
r
this works for me Select * from (SELECT TOP 1 id FROM transaction ) as trans1 UNION SELECT TOP 1 id FROM transaction as trans2 where trans2.id =11691
this also works
Select * from (SELECT TOP 1 id FROM employee ) as trans1 UNION SELECT TOP 1 id FROM transaction as trans2 where trans2.id =11691
j
You can definitely
UNION
.
for example, say I had a field on two tables that represented similar data, and I wanted to get all unique values across both tables. Could do something like this:
Copy code
SELECT DISTINCT thisismyfield FROM (

	SELECT custrecord_myfield1 AS thisismyfield FROM customrecord_record1

	UNION

	SELECT custrecord_myfield2 AS thisismyfield FROM customrecord_record2

)
b
Thanks!