I have a table users with (id,name) and user_messages(m_id,user_id,msg_seen) and now i want to count the number of messages per user(like whatsapp)how to write a sql query for that? i have bulded it for a user who has looged in and now i want to show the number of messages per user?I mean i want to show me the amount of messagges which were send by other users
Asked
Active
Viewed 141 times
-4
-
Possible duplicate of [MySQL: Count occurrences of distinct values](https://stackoverflow.com/questions/1346345/mysql-count-occurrences-of-distinct-values) – Shadow Dec 03 '18 at 09:05
1 Answers
0
Try this
"SELECT COUNT(m_id) FROM user_messages WHERE user_id != $_SESSION['user_id']"

MD. Jubair Mizan
- 1,539
- 1
- 12
- 20
-
I mean i want to show me the amount of messagges which were send by other users – user9541521 Dec 03 '18 at 08:59