Hello,
I have a query which gives a weird result. The query is:
SELECT SUM(t1.hits) AS tab1, SUM(t2.hits) AS tab2
FROM table1 AS t1, table2 AS t2
When I run it, it gives the result threefold.
Say the data in the two tables would be:
| table1 | table2 |
===================
| 1 | 4 |
| 2 | 5 |
| 3 | 6 |
The query gives the result:
| tab1 | tab2 |
===============
| 18 | 45 |
As everyone knows: (1+2+3)*3=18 and (4+5+6)*3=45
Both tables have identical settings for the fields fld1 and fld2, they just have a different name.
Can anyone tell me what's going wrong?
Thanks for your time!
I have a query which gives a weird result. The query is:
SELECT SUM(t1.hits) AS tab1, SUM(t2.hits) AS tab2
FROM table1 AS t1, table2 AS t2
When I run it, it gives the result threefold.
Say the data in the two tables would be:
| table1 | table2 |
===================
| 1 | 4 |
| 2 | 5 |
| 3 | 6 |
The query gives the result:
| tab1 | tab2 |
===============
| 18 | 45 |
As everyone knows: (1+2+3)*3=18 and (4+5+6)*3=45
Both tables have identical settings for the fields fld1 and fld2, they just have a different name.
Can anyone tell me what's going wrong?
Thanks for your time!