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
Devinder KumarPosted Jan 15, 2014, 6:34 AM
you will not get proper record because here you need to map column by string type district column so first make unique ID column for every record and repeat id column for every repeated record in another table then you will get final proper result