我有一个名为private_message
的表格,其中包含以下字段:sender
和receiver
我想知道特定发件人有多少次向某个人发送邮件,例如:
**Name** **Times**
David 5
Michael 2
John 1
答案 0 :(得分:1)
试试这个:
SELECT
sender as 'From',
receiver as 'To',
count(receiver) as 'Times'
FROM private_message
GROUP BY sender, receiver
结果可能类似于:
From To Times
David Emil 5
Michael Møller 2
John Ringgaard 1
Emil Ravinder 1