Code: Select all
SELECT DISTINCT email FROM table WHERE ...Code: Select all
SELECT DISTINCT email, fname FROM table WHERE ...Ideas?
Moderator: General Moderators
Code: Select all
SELECT DISTINCT email FROM table WHERE ...Code: Select all
SELECT DISTINCT email, fname FROM table WHERE ...Agreedastions wrote:I have done this in a while, I think your looking for Group By.
Code: Select all
SELECT DISTINCT person.email, person.id, person.name WHERE ...Actually I'm fairly sure it takes into account the uniqueness of all the columns specified. If it's possible that the email address can show up more than once in the result set then you want to use DISTINCT and specify both the email and another unique identifier to your mailing list.Hockey wrote: I added other fields to my query and they are returned fine in the resultset, so it looks like DISTINCT only binds to the first field...
Ok...PI R *actually* round NOT squaredIt's also been awhile since I've buggered with DISTINCT, so feel free to prove me wrong
Code: Select all
SELECT email,fname FROM table GROUP BY email
Code: Select all
SELECT DISTINCT email, fname FROM table WHERE ...Code: Select all
SELECT email, fname FROM table WHERE ... GROUP BY email, fnameCode: Select all
SELECT DISTINCT email, fname, COUNT(*) FROM table WHERE ...Code: Select all
SELECT email, fname, COUNT(*) FROM table WHERE ... GROUP BY email, fname