-4

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

Shadow
  • 33,525
  • 10
  • 51
  • 64
  • 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 Answers1

0

Try this

"SELECT COUNT(m_id) FROM user_messages WHERE user_id != $_SESSION['user_id']"
MD. Jubair Mizan
  • 1,539
  • 1
  • 12
  • 20