Mysql How to show the number of authorizations (count) for each user?

Have a database with fields Auth_date, Login, IP, every time you authorization, we add to the data.
Tell me how to remove the number of authorizations for each user?
April 7th 20 at 15:53
3 answers
April 7th 20 at 15:55
COUNT, GROUP BY
April 7th 20 at 15:57
SELECT
u.login
count(a.auth_date)
FROM
 users u
 JOIN auth_table a ON u.login = a.login
WHERE
 -- some condition
GROUP BY u.login
Why JOIN?
In this case, the history table inputs set the Login, not the ID - table is self-sufficient.

SELECT login, count(*) FROM auth_table WHERE 1 GROUP BY login - blaise37 commented on April 7th 20 at 16:00
@esta79why "WHERE 1"? - Vince89 commented on April 7th 20 at 16:03
@telly.Haag, that the author knew where to write the condition. - blaise37 commented on April 7th 20 at 16:06
@esta79, without the "WHERE 1" all works and GROUP BY is not really a condition, but just the grouping. - Vince89 commented on April 7th 20 at 16:09
April 7th 20 at 15:59
select count(Login), Login from tableName group by Login;
@Harvey.Reilly29happened? - Vince89 commented on April 7th 20 at 16:02

Find more questions by tags MySQL