pmnox
asked on
Can I use union with sql subqueries?
Can I use union with sql subqueries?
SELECT * FROM TABLE WHERE 1 = (SELECT 1 FROM msysaccessobjects UNION SELECT 1 FROM msysaccessobjects)
I tried to use union with sql subqueries. However I get an error when I try to compile this sql query. Does UNION work with sql subqueries?
SELECT * FROM TABLE WHERE 1 = (SELECT 1 FROM msysaccessobjects UNION SELECT 1 FROM msysaccessobjects)
I tried to use union with sql subqueries. However I get an error when I try to compile this sql query. Does UNION work with sql subqueries?
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Can you explain the point of the query.
It won't work with a union in the subquery but even if it did , the query would be just the same as one which just says:
Select * from table
It won't work with a union in the subquery but even if it did , the query would be just the same as one which just says:
Select * from table
ASKER
Thx for help.
But since your subquery will return more than 1 value, you need to use IN instead of =
SELECT * FROM TABLE WHERE 1 IN (SELECT 1 FROM msysaccessobjects UNION SELECT 1 FROM msysaccessobjects)