greetings
how do i generate total numbers using COUNT() and summary using SUM()
with a join statement
im getting empty result
the sql below is a basic things like what my current SQL do now
select table1.name, table1.lastname, table1.numberofgames,
DATEDIFF(CURDATE(),table1.last_game) AS Lastgameday
from table1
Having lastgameday<10
now this display the output needed
but then there is a new revision which I will have to join the join also has subqueries and count and other query computation
select table1.name, table1.last, count(table2.numberofgames) as numberofgames, sum(table2.shoot)as totalshoot, sum(table2.shoot)/count(table2.numberofgames) as perg,
DATEDIFF(CURDATE(),table1.last_game) AS Lastgameday
from table1
left join (select * from table2 where where DATEDIFF(CURDATE(),table2.last_seen_online))table2 on (table1.id = table2.teamid)
Having lastgameday<10
why this query return 0 ?
TIA