The first code like this
SELECT s.name, w.channel, COUNT(*) num_events
FROM accounts a
JOIN web_events w
ON a.id = w.account_id
JOIN sales_reps s
ON s.id = a.sales_rep_id
GROUP BY s.name, w.channel
ORDER BY num_events DESC;
The second code like this
SELECT s.name, w.channel, COUNT(w.channel)
FROM web_events w
JOIN accounts a
ON a.id = w.account_id
JOIN sales_reps s
ON s.id = a.sales_rep_id
GROUP BY s.name, w.channel
ORDER BY COUNT(w.channel) DESC
Both codes have the same results. But why? What is different from COUNT(*) num_events to COUNT(w.channel)?