On 6/12/01 10:42 AM W Luke wrote:

> 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.

Distinct selects distinct *rows*, so if the comDate value for each row is
different, it will select all four rows for [EMAIL PROTECTED] Remove the
comDate column from the query and you will get the desired result, (well,
sort of, since obviously you want that column value for some reason.

- Sean
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
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