As a question is the comDate different for each of the duplicate emails
records? If so drop the date from the query or use a group by query to
select the maximum date.

Yours,

Gary Longford

-----Original Message-----
From: W Luke [mailto:[EMAIL PROTECTED]]
Sent: 12 June 2001 15:43
To: CF-Talk
Subject: Correct use of "distinct" in queries


Hi,

I'm having a nightmare today - it's like banging my head against a CF wall..

I'm trying to do the most basic of queries.  Select distinct email addresses
from a table, and email them using cfmail.  But for some reason it's not
pulling unique addresses - is this because I have a WHERE statement?

 <cfquery name="getothers" datasource="LBTalk">
 SELECT distinct comEmail, comDate FROM comments
 WHERE comEmail <> '#form.email#'
 AND comAdID = #form.adID#
 </cfquery>

[EMAIL PROTECTED] has 4 entries with form.adID in the table comments - but
he should only receive one email.

Any suggestions appreciated

Will
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Structure your ColdFusion code with Fusebox. Get the official book at 
http://www.fusionauthority.com/bkinfo.cfm

Archives: http://www.mail-archive.com/[email protected]/
Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists

Reply via email to