Try the following:
SELECT (Select count(*) FROM tbl_Events) + (Select count(*) FROM tbl_Events2)
Or (verified in MSSQL), this is:
SELECT COUNT(*)
FROM (SELECT * FROM tbl_Events
UNION ALL
SELECT * FROM tbl_Events2) AS AllEvents
I assume that the former will lead to better performance, since it has more obvious index parameters. Of course, make sure.
source
share