C
C
celovec2020-02-19 13:22:47
MySQL
celovec, 2020-02-19 13:22:47

Mysql How to display the number of authorizations (count) per user?

There is a database with fields Auth_date, Login, IP, each time we log in, we add data there.
Tell me how to display the number of authorizations per user?

Answer the question

In order to leave comments, you need to log in

2 answer(s)
R
Rsa97, 2020-02-19
@Rsa97

COUNT, GROUP BY

I
irishmann, 2020-02-19
@irishmann

SELECT
    u.login,
    count(a.auth_date)
FROM
    users u
    JOIN auth_table a ON u.login = a.login
WHERE
    -- какое-то условие
GROUP BY u.login

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question