If I have three columns:
orderNumber, name, email
and I would like to count how many unique emails are in the table how would I go about do
For best performance you should use:
SELECT sub.email, count(1) as 'count_unique' FROM (SELECT email FROM orders GROUP by email) sub