I want to select rows that have a distinct email
, see the example table below:
+----+---------+-------------------+-------------+
| id | title | email | commentname |
+----+---------+-------------------+-------------+
| 3 | test | rob@hotmail.com | rob |
| 4 | i agree | rob@hotmail.com | rob |
| 5 | its ok | rob@hotmail.com | rob |
| 6 | hey | rob@hotmail.com | rob |
| 7 | nice! | simon@hotmail.com | simon |
| 8 | yeah | john@hotmail.com | john |
+----+---------+-------------------+-------------+
The desired result would be:
+----+-------+-------------------+-------------+
| id | title | email | commentname |
+----+-------+-------------------+-------------+
| 3 | test | rob@hotmail.com | rob |
| 7 | nice! | simon@hotmail.com | simon |
| 8 | yeah | john@hotmail.com | john |
+----+-------+-------------------+-------------+
Where I don't care which id
column value is returned.
What would be the required SQL?