I have a few MySQL tables like below
Table1 Att1 | Flag xxx | 1 Table2 Att1 | Flag xxx | 2 yyy | 2 Table3 Att1 | Flag xxx | 3 yyy | 3 Table4 Att1 | Flag xxx | 4 Table5 Att1 | Flag xxx | 6
Each table has got a few attributes along with the above. I would like to sum flag attributes of each table and VIEW them. MySQL code is below.
create view block as select sum(table1.flag)as table1, sum(table2.flag)as table2, sum(table3.flag) as table3,sum(table4.flag) as table4, sum(table5.flag) as table5 from table1,table2,table3,table4,table5;
What i see in my view is:
table1|table2|table3|table4|table5 4 |8 |12 |16 |24
What i actually want to see in my view is:
table1|table2|table3|table4|table5 1 |4 |6 |4 |6
help me! Thanks in advance!