Posted By

flatearthcomms on 12/08/08


Tagged


Versions (?)

Selecting only one occurrence from a column


 / Published in: SQL
 

DISTINCT will 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.

  1. SELECT DISTINCT(email), newsletter FROM contact_tbl WHERE newsletter != 0;
  2.  
  3. SELECT email, newsletter FROM contact_tbl WHERE newsletter != 0 GROUP BY email;

Report this snippet  

You need to login to post a comment.