dimanche 29 mars 2015

include users having no records

I am a newbie in relational db and I have 2 tables:


user



id | userName | email | col1 | col2



log



ID | user_id | cl1 | cl2 | cl3



And I want in my admin section to view all the users along with the count of their records. I am using SQLite3 as my DB



SELECT user_id,username,email,count(link)'count' FROM log,user where user_id=user.id group by user_id;


it works fine but doesn't include users having no record in log table please help how can I make it include all the users and show the count value as 0.


Aucun commentaire:

Enregistrer un commentaire