php - MySQL count should return 0, returns nothing -
i have mysql query, seems pretty easy:
select users.nick, users.id, count(pm.id) pms users left join pm on users.id = pm.touser users.id = :id , pm.read = 0 group users.id what want here count pms aren't read (doesn't have "1" in "read" col). if there any, query works fine, when there isn't row meeting condition, returns nothing.
i spent last hour looking solution, seems odd, works way. should print "0" while echoing "pms".
simply:
select users.nick, users.id, count(pm.id) pms users left join pm on (users.id = pm.touser , pm.read = 0) users.id = :id group users.id;
Comments
Post a Comment