MySQL, PHP, How Many in GROUP
Posted
by
0Neji
on Stack Overflow
See other posts from Stack Overflow
or by 0Neji
Published on 2012-10-31T10:58:36Z
Indexed on
2012/10/31
10:59 UTC
Read the original article
Hit count: 88
I'm trying to create a table which outputs a list of users and how many times they've logged in.
A new row in the table is created every time that someone logs in so there is multiple rows for one user.
Now, I'm trying using the following statement to pull the data out:
SELECT * FROM logins GROUP BY user ORDER BY timestamp DESC
Which is working fine but now there is a column in my HTML table which should show how many times the user has logged in. How do I go about counting the amount of rows in each group?
© Stack Overflow or respective owner