I have a particular question which is about MySQL. Please have a look at the query and the result set below:
SELECT `SentTo`,
`Read`
FROM `Emails` as t
[email protected] | 1
--------------------------------
[email protected] | 0
--------------------------------
[email protected] | 1
--------------------------------
[email protected] | 0
--------------------------------
[email protected] | 1
--------------------------------
I'd like to get the count of the emails for each email, and the total Read. I will get unread by subtracting total and read on the script side, don't really need it here.
Email | Total | Read
--------------------------------------
[email protected] | 3 | 1
--------------------------------------
[email protected] | 2 | 1
--------------------------------------
Any advice? I have tried to apply sub-queries to this but I couldn't find a proper solution.