-
Notifications
You must be signed in to change notification settings - Fork 24
Queries
Dawn Foster edited this page May 29, 2015
·
5 revisions
SELECT COUNT(DISTINCT(messages.message_ID)) AS total, messages_people.email_address
FROM messages, messages_people
WHERE messages.message_ID = messages_people.message_id
AND messages_people.type_of_recipient = 'From'
GROUP BY messages_people.email_address
ORDER BY total DESC
LIMIT 100
SELECT COUNT(DISTINCT(messages.message_ID)) AS total, messages_people.email_address
FROM messages, messages_people
WHERE messages.message_ID = messages_people.message_id
AND messages_people.type_of_recipient = 'From'
AND YEAR(messages.first_date) = 2013
GROUP BY messages_people.email_address
ORDER BY total DESC
LIMIT 100
SELECT subject, monthname(first_date), COUNT(*) as total
FROM messages
GROUP BY subject, month(first_date)
ORDER by total DESC
LIMIT 100
SELECT COUNT(*) FROM messages;