I want to get the row with the nth distinct value in a column, as ordered by another column.
In more real terms, I want the 1000th distinct
email_address as ordered by
created_at, and the
email_address column does not have a unique constraint.
I believe I have done this correctly with the following query:
SELECT `email_address` FROM footable GROUP BY `email_address` ORDER BY `created_at` ASC LIMIT 1 OFFSET 1000
But I am not totally confident that is giving me the right value.
Is the above query correct for this purpose? If not, how should I solve this?