Using Distinct in MYSQL Query For Output

Using Distinct For Output

Using distince in a query will output distince values for a chosen query.
For example, look at the following query:
"SELECT DISTINCT name from tablename;"

If there are two exact names in the names column, the query will output the second name. Who cares, right? But what of the query wanted distinct name and email like the query below:
"SELECT DISTINCT name, email from tablename;"

The result will retrieve rows with distinct name and email combinations which can be output in a table or list.

If the data in the list was submitted from a form, and some users had submitted the same email and name more than once, you will not see all entries for a distinct user. You will only see the earliest entry of a specific name / email combination.