This may not be the most efficient way to do it. But it'll work.
<cfquery name="getothers" datasource="LBTalk">
SELECT comEmail, comDate FROM comments
WHERE comEmail <> '#form.email#'
AND comAdID = #form.adID#
ORDER BY comEmail
</cfquery>
<cfset cemail = "">
<cfoutput query="getothers">
<cfif comEmail neq cemail>
<CFMAIL ....>
</cfmail>
</cfif>
<cfset cemail = comEmail>
</cfoutput>
On Jun 12, 2001 at 3:42 PM, you wrote...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