Thread: Using Distinct
View Single Post
 
Old December 1st, 2007, 10:55 AM
Smeghead Smeghead is offline
Registered User
 
Join Date: Nov 2007
Location: , , United Kingdom.
Posts: 8
Thanks: 0
Thanked 0 Times in 0 Posts
Default

All of the phone numbers in the table, its so a mailshot or telephone campaign can be done, so I may have several people living at the same address, but I only want to do one letter or phone call to only one member of the household.

Scenario: I may want to do a mailshot for people living in a certain postcode (zipcode) area or maybe target a certain age group

I tried using MAX or MIN with a combination of HAVING count(*) = 1

Because the row was not uniquely the same it kept seeing the row as a different one, as the contact name was different.

Doing a SELECT COUNT (DISTINCT TEL) seem to work for the count but because I then wanted to an output using all the fields, it then went a bit haywire.

SQL can be so frustrating at times.:(