In this simplified example, I have the following query:
SELECT COUNT(*) AS OrderCount
FROM Orders
UNION
SELECT COUNT(*) AS CustomerCount
FROM Customers
Which results in the following output:
Order Count |
---|
135 |
283 |
But I would like the output to be:
OrderCount | CustomerCount |
---|---|
135 | 283 |
You can select like below, if there is any relation between orders and customers you can use joins as well
SELECT
(SELECT COUNT(*) FROM Orders) AS OrderCount,
(SELECT COUNT(*) FROM Customers) AS CustomerCount;
OrderCount | CustomerCount |
---|---|
135 | 283 |