Count(*) from multiple tables

How do i pull a count(*) from 6 tables. Each has a Account ID that should be matched.

Account ID table1 table2 table3 table3 ...
-------------------------------------------------
0001          10         21       7         8
0004 .................
bender007Asked:
Who is Participating?
 
Anthony PerkinsCommented:
Select AccountID,
          COUNT(*) Table1Count,
          (Select COUNT(*) From Table2 t2 Where t1.AccountID = t2.AccountID) Table2Count,
          (Select COUNT(*) From Table3 t3 Where t1.AccountID = t3.AccountID) Table3Count,
...
          (Select COUNT(*) From Tablen tn Where t1.AccountID = tn.AccountID) TablenCount
From Table2 t1
Group By t1.AccountID

0
 
bender007Author Commented:
What is Table1Count .... I am confused.
0
 
bender007Author Commented:
Ok its an alias, I got that ,  why start from Table2 ?
0
 
Anthony PerkinsCommented:
>>why start from Table2 ?<<
Look again.  I started with Table1.
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.