I have a table where all the employee data with country and city
Main table Tbl_Emp
ID Name Dept CountryID CityID
1 Arun Bikas Das IT 1 1
2 Abhineet Prakash IT 1 1
3 Avnish Dhoundiyal HR 2 5
4 Amit Batra HR 3 6
5 Ajay Sethi AC 3 6
6 Amarendra Pandey AC 3 6
7 Abhijit Singh ADM 1 3
8 Anil Kumar ADM 1 4
9 Mahesh Venu MAR 1 7
10 Mohamed Rafi MAR 1 9
Tbl_County
is
C_ID Country
1 India
2 USA
3 UK
tbl_city
is
C_ID City CountryID
1 Delhi 1
2 Delhi 1
3 Mumbai 1
4 Nagpur 1
5 NewYork 2
6 Caneda 3
7 Jaipur 1
9 Panjab 1
I want to select employees count by county:
Country Employees
------- ---------
India 6
USA 1
UK 3
, and same for the city:
City Employees
------- ---------
Delhi 2
Mumbai 1
NewYork 1
Canada 3
Nagpur 1
Jaipur 1
Panjab 1