1
Reply

Query in sql server

Bharat  Bhushan

Bharat Bhushan

Jan 15 2014 4:12 AM
1.1k
Hello Developers


I have three tables named

tb_fst_form

id    district   identification

1     Amritsar     yes

2     Amritsar     yes

3     Bathinda     Yes

4     Barnala      Yes

tb_second_form

id    district   identification

1     Gurdaspur     yes

2     Amritsar      yes

3     Bathinda      Yes

4     Barnala       Yes


tb_third_form

id    district   identification

1     Tarntaran     yes
 
2     Amritsar      yes

3     Bathinda      Yes

4     Barnala       Yes




Now i need an sql query to fetch combine records from three tables district wise


Like


District      fst_table_count      second_table_count      third_table_count


Tarntaran        0                         0                             1

Amritsar         2                          1                             1

Barnala          1                          1                             1

Bathinda        1                          1                             1

Gurdaspur      0                          1                             0

Please help me to create the mysql query

Thanks

Bharat Bhushan


Answers (1)