Click here to Skip to main content
15,901,205 members
Please Sign up or sign in to vote.
1.00/5 (2 votes)
See more:
SELECT COUNT(*)
FROM Customer
UNION
SELECT COUNT(*)
FROM Transactions
UNION
SELECT COUNT(*)
FROM prod_cat_info


What I have tried:

SELECT COUNT(*)
FROM Customer
UNION
SELECT COUNT(*)
FROM Transactions
UNION
SELECT COUNT(*)
FROM prod_cat_info
Posted
Updated 7-Jan-22 1:12am
Comments
Richard Deeming 7-Jan-22 7:03am    
You seem to have forgotten to ask a question.

1 solution

If what you are looking for is to get the result as a single query result, then try this:
SQL
SELECT (SELECT COUNT(*) FROM Customer) AS CustCnt,
       (SELECT COUNT(*) FROM Transactions) AS TransCnt,     
       (SELECT COUNT(*) FROM prod_cat_info) AS ProdCnt
 
Share this answer
 
Comments
Maciej Los 11-Jan-22 7:23am    
Single query with set of subqueries ;)

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900