I am trying to fetch counts from different tables in SQL Server 2012.
My query looks like:
SELECT
(
(SELECT COUNT(dbo.Table1.column1) FROM dbo.Table1) AS A,
(SELECT COUNT(dbo.Table2.column1) FROM ddbo.Table2) AS B,
(SELECT COUNT(dbo.Table3.column1) FROM dbo.Table3) AS C
)
I get these errors:
Msg 156, Level 15, State 1, Line 2
Incorrect syntax near the keyword 'AS'.Msg 156, Level 15, State 1, Line 4
Incorrect syntax near the keyword 'AS'.Msg 156, Level 15, State 1, Line 6
Incorrect syntax near the keyword 'AS'.Msg 156, Level 15, State 1, Line 8
Incorrect syntax near the keyword 'AS'.Msg 156, Level 15, State 1, Line 10
Incorrect syntax near the keyword 'AS'.
Please help me out of this situation.
Change to:
SELECT
(Select count(dbo.Table1.column1) from dbo.Table1) AS A,
(Select count(dbo.Table2.column1) from dbo.Table2) AS B,
(Select count(dbo.Table3.column1) from dbo.Table3) AS C
Collected from the Internet
Please contact [email protected] to delete if infringement.
Comments