Liam Delahunty: Home Tips Web Contact

Sponsors:

Recommended laptop
under £500
.

Think I deserve a present? See my Amazon Wish List

MySQL DISTINCT or GROUP BY


 
SELECT DISTINCT(email), newsletter FROM contact_tbl WHERE newsletter != 0;
1721 rows in set (0.42 sec)

 
SELECT email, newsletter FROM contact_tbl WHERE newsletter != 0 GROUP BY email;
1702 rows in set (0.42 sec)

DISTINCT will in the example above produce more results if a user had been added with more than one type of newsletter. The GROUP BY clause will just get the single email.

Share this!  



Mysql Day Of Year | Mysql Distinct Or Group By | Mysql Errno 145


 

  Tips | Home | Search | Contact

Link here: