SQL Multiple select count statements in one query
database, sql, t-sql
Solution
SELECT A, B, C
FROM (SELECT COUNT(cars) as A FROM tableCars) a
CROSS JOIN (SELECT COUNT(boats) as B FROM tableBoats) b
CROSS JOIN (SELECT COUNT(trees) as C FROM tableTrees) c
should do it.
Problem
I have data with no relation. Just need to count various columns from 3 tables and display them on the page as a view. This is the code so far but doesn't work: ``` SELECT COUNT(cars) AS A, (SELECT COUNT(boats) FROM tableBoats) AS B, (SELECT COUNT(trees) FROM tableTrees) AS C, FROM tableCars ```