I have the folowwing SQL query
SELECT CustomerID FROM sales WHERE `Date` <= \'2012-01-01\' GROUP BY CustomerID
The query is executed over 11
Wouldn't this one be a lot faster and achieve the same?
SELECT DISTINCT CustomerID FROM sales WHERE `Date` <= '2012-01-01'
Make sure to place an index on Date, of course. I'm not entirely sure but indexing CustomerID might also help.
Date
CustomerID