cf-talk  

Re: Troubles with duplicates in select, only need one row per email address.

John M Bliss
Wed, 17 Mar 2010 11:44:18 -0700

> I just want 1 LeadID and 1 Email out of the 4 records.

Which one LeadID?  If you want the min, just do:

SELECT Email MIN(LeadID) AS LeadID
FROM Leads
group by Email


On Wed, Mar 17, 2010 at 11:25 AM, Casey Dougall <
ca...@uberwebsitesolutions.com> wrote:

>
> Hi,
>
> This always drives me nuts and I can never figure it out or where on earth
> I'm doing something simular.
>
>
>
>  LeadID Email  1 ca...@domain.com  2 ca...@domain.com  3 ca...@domain.com 4
> ca...@domain.com
>
> I just want 1 LeadID and 1 Email out of the 4 records.
>
> Why can't you group by 1 column when really want to select 2 or more at the
> same time. :-(
>
>   SELECT distinct (Email), LeadID
>   FROM Leads
>   group by Email
>
> I just wish that would work. Mind you there a bunch of additional columns
> so
> it's more like needing
>
> SELECT distinct (Email), LeadID, FirstName, LastName
> FROM Leads
>
>
> Dam I hate this scenario.
>
>
> 

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Want to reach the ColdFusion community with something they want? Let them know 
on the House of Fusion mailing lists
Archive: 
http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:331825
Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm