Reputation: 1332
I have a table customers
. How can I select only ids for the distinct values in the email column?
+----+------------------+
| Id | Email |
+----+------------------+
| 1 | [email protected] |
| 2 | [email protected] |
| 3 | [email protected] |
| 4 | [email protected] |
| 5 | [email protected] |
+----+------------------+
So the result will be:
[1,2,3,5]
So far, I've tried:
select distinct id, email from customers group by id;
Upvotes: 1
Views: 40