it's because distinct is applied to the combination of columns in your
select clause.
if you look, you're selecting distinct email, comdate. that will give you
every combination of distinct emails and comdates.
i would guess that [EMAIL PROTECTED] has 4 different comdate in your
current resultset. simple answer would be to remove the comdate from your
select clause.
chris olive, cio
cresco technologies
[EMAIL PROTECTED]
http://www.crescotech.com
-----Original Message-----
From: W Luke [mailto:[EMAIL PROTECTED]]
Sent: Tuesday, June 12, 2001 10:43 AM
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