1
Good afternoon Guys, I have these two tables that relate to know how many times a user accessed the system:
And I have this query:
select nome_usuario, count(id_log) as qtde from logs as l left join usuario as u on l.usuario_log = u.id_usuario group by usuario_log order by qtde desc
Today it brings me the result of how many times the user accessed. And I would like that if not find table records log
assign zero '0' as I do this?
you want to bring all users independent if you do not have in the log table.
– novic
That, and assigning 0.
– Eduardo Santos
I leave as a tip: When relating tables, use exactly the same name in the columns id, facilitates understanding and makes it possible to use the clause using in the query, which is very practical...
– Jader A. Wagner