Will,

Distinct applies to the entire row being returned (in this case, comEmail
AND comDate).  So if you want distinct comEmail then you can only return
comEmail.

Jon Finley


> -----Original Message-----
> From: W Luke [mailto:[EMAIL PROTECTED]]
> Sent: Tuesday, June 12, 2001 9: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

Reply via email to