+-------------------+---------------------+------+-----+---------+----------------+
| RowId | MSGID| Received| UID | Default | |
+-------------------+---------------------+------+-----+---------+----------------+
| 1 | 1 | NO | 1 | NULL | |
| 2 | 1 | YES | 3 | NULL | |
| 3 | 1 | YES | 4 | NULL | |
| 4 | 1 | YES | 5 | NULL | |
| 5 | 5 | YES | 2 | NULL | |
| 6 | 2 | YES | 8 | NULL | |
| 7 | 1 | YES | 9 | NULL | |
+-------------------+---------------------+------+-----+---------+----------------+
This is my table in MySQL.
How can I get count of messages where MSGID = 1 and count of no of users who have received message where MSGID = 1 and count of no of users who haven’t received message where MSGID = 1?
I want to do it in a loop so that I can Get three values like [5,4,1]. So each time the page load the query will check the database and update the sets. pls help
First to get a count for the number of messages where MSGID = 1
To get a count of the number of users who have received a msg where MSGID = 1
To get a count of the number of users who haven’t received a msg where MSGID = 1