January 29, 2009 at 12:51 pm
I have this query and I need it to return distinct lc.email field
select top 1000
l.leadid,
l.datecreated,
lc.firstname,
lc.lastname,
lc.address1,
lc.city,
lc.state,
lc.zipcode,
lc.phone1,
lc.email,
case l.lcpid
when 182 then 'ORGANIC'
when 129 then 'ORGANIC'
else 'AFFILIATE'
end as [type],
case a.auctionstatusid
when 4 then 'REJECT'
else 'ACCEPT'
end as reply_decision,
ltr.[rule] as reject_reason
from lead l
join leadcontact lc
on l.leadcontactid = lc.leadcontactid
join auction a
on l.leadid = a.leadid
left join
leadtargusratings ltr
on l.leadid = ltr.lead
where l.leadtypeid = 1
and a.payout > 0
order by l.datecreated desc
So I tried this but am still getting duplicates - why?
select top 1000 * from (
select
distinct(lc.email),
l.leadid,
l.datecreated,
lc.firstname,
lc.lastname,
lc.address1,
lc.city,
lc.state,
lc.zipcode,
lc.phone1,
case l.lcpid
when 182 then 'ORGANIC'
when 129 then 'ORGANIC'
else 'AFFILIATE'
end as [type],
case a.auctionstatusid
when 4 then 'REJECT'
else 'ACCEPT'
end as reply_decision,
ltr.[rule] as reject_reason
from lead l
join leadcontact lc
on l.leadcontactid = lc.leadcontactid
join auction a
on l.leadid = a.leadid
left join
leadtargusratings ltr
on l.leadid = ltr.lead
where l.leadtypeid = 1
and a.payout > 0
) as t
order by datecreated desc
January 29, 2009 at 1:02 pm
SG (1/29/2009)
So I tried this but am still getting duplicates - why?
select top 1000 * from (
select
distinct(lc.email),
l.leadid,
Distinct is not a function. Check Books online, see how it's used.
Brackets are optional around any column in the select, so I can write
SELECT distinct
(email), (leadid), (datecreated)...
or I can write
SELECT distinct
email, leadid, datecreated...
and have exactly the same meaning. Distinct means no duplicate rows and it affects the entire row.
So, you want only unique email adresses. What about the other columns in the table? Which values from which columns should be shown if there's an email address that appears twice in the table?
Gail Shaw
Microsoft Certified Master: SQL Server, MVP, M.Sc (Comp Sci)
SQL In The Wild: Discussions on DB performance with occasional diversions into recoverability
January 29, 2009 at 1:27 pm
Thanks, I was under the impression that the brackets represented the distinct.
If there are multiple emails, I want the one with the highest leadid.
January 29, 2009 at 1:38 pm
Then try something like this:
select top 1000 * FROM
(SELECT lc.email
l.leadid,
l.datecreated,
lc.firstname,
lc.lastname,
lc.address1,
lc.city,
lc.state,
lc.zipcode,
lc.phone1,
lc.email,
case l.lcpid
when 182 then 'ORGANIC'
when 129 then 'ORGANIC'
else 'AFFILIATE'
end as [type],
case a.auctionstatusid
when 4 then 'REJECT'
else 'ACCEPT'
end as reply_decision,
ltr.[rule] as reject_reason,
ROW_NUMBER() OVER (Partition by email Order By LeadId DESC) AS EmailNo
from lead l
join leadcontact lc
on l.leadcontactid = lc.leadcontactid
join auction a
on l.leadid = a.leadid
left join
leadtargusratings ltr
on l.leadid = ltr.lead
where l.leadtypeid = 1
and a.payout > 0) sub
WHERE EmailNo = 1
order by datecreated desc
Edit: hit post by mistake
Gail Shaw
Microsoft Certified Master: SQL Server, MVP, M.Sc (Comp Sci)
SQL In The Wild: Discussions on DB performance with occasional diversions into recoverability
January 29, 2009 at 1:51 pm
That's what I started with before I tried the distinct, I tried it again but still got duplicates.
I think the issue maybe this join -
from lead l
join leadcontact lc
on l.leadcontactid = lc.leadcontactid
Although the leadcontactID is unique, there are multiple leadcontactid's for the same email address.
Is there a way to weed those out?
January 29, 2009 at 1:59 pm
SG (1/29/2009)
That's what I started with before I tried the distinct, I tried it again but still got duplicates.
Can you strip the query down to just the essentials (that still give the duplicate problem), post the schema definitions of tables, some sample data and your desired results.
Read this to see the best way to post this to get quick responses.
http://www.sqlservercentral.com/articles/Best+Practices/61537/
Gail Shaw
Microsoft Certified Master: SQL Server, MVP, M.Sc (Comp Sci)
SQL In The Wild: Discussions on DB performance with occasional diversions into recoverability
January 29, 2009 at 2:42 pm
Here's the data - Thanks in advance for your help.
The forum etiqutte page helped quite a bit...
----Lead and LeadContact schema
/****** Object: Table [dbo].[Lead] Script Date: 01/29/2009 13:09:33 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
GO
IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[Lead]') AND type in (N'U'))
BEGIN
CREATE TABLE [dbo].[Lead](
[LeadId] [bigint] IDENTITY(1,1) NOT FOR REPLICATION NOT NULL,
[LeadContactId] [bigint] NULL,
CONSTRAINT [PK__Leads__5AB9788F] PRIMARY KEY CLUSTERED
(
[LeadId] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY],
CONSTRAINT [UQ__Leads__5BAD9CC8] UNIQUE NONCLUSTERED
(
[LeadId] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
) ON [PRIMARY]
END
GO
SET ANSI_PADDING OFF
GO
/****** Object: Table [dbo].[LeadContact] Script Date: 01/29/2009 13:09:52 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
GO
IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[LeadContact]') AND type in (N'U'))
BEGIN
CREATE TABLE [dbo].[LeadContact](
[LeadContactId] [bigint] IDENTITY(1,1) NOT FOR REPLICATION NOT NULL,
[Email] [varchar](100) NOT NULL,
CONSTRAINT [PK__LeadContacts__09746778] PRIMARY KEY CLUSTERED
(
[LeadContactId] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY],
CONSTRAINT [UQ__LeadContacts__0A688BB1] UNIQUE NONCLUSTERED
(
[LeadContactId] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
) ON [PRIMARY]
END
GO
SET ANSI_PADDING OFF
GO
--Data for Lead table
SELECT '12201','12162', UNION ALL
SELECT '12202','12163', UNION ALL
SELECT '12203','12164', UNION ALL
SELECT '12204','12165', UNION ALL
SELECT '12205','12166', UNION ALL
SELECT '12206','12167', UNION ALL
SELECT '12207','12168', UNION ALL
SELECT '12208','12169', UNION ALL
SELECT '12209','12170', UNION ALL
SELECT '12210','12171', UNION ALL
SELECT '12211','12172', UNION ALL
SELECT '12212','12173', UNION ALL
SELECT '12213','12174', UNION ALL
SELECT '12214','12175', UNION ALL
SELECT '12215','12176', UNION ALL
SELECT '12216','12177', UNION ALL
SELECT '12217','12178', UNION ALL
SELECT '12218','12179', UNION ALL
SELECT '12219','12180', UNION ALL
SELECT '12220','12181', UNION ALL
SELECT '12221','12182', UNION ALL
SELECT '12222','12183', UNION ALL
SELECT '12223','12184', UNION ALL
SELECT '12224','12185', UNION ALL
SELECT '12225','12186', UNION ALL
SELECT '12226','12187', UNION ALL
SELECT '12227','12188', UNION ALL
SELECT '12228','12189', UNION ALL
SELECT '12229','12190', UNION ALL
SELECT '12230','12191', UNION ALL
SELECT '12231','12192', UNION ALL
SELECT '12232','12193', UNION ALL
SELECT '12233','12194', UNION ALL
SELECT '12234','12195', UNION ALL
SELECT '12235','12196', UNION ALL
SELECT '12236','12197', UNION ALL
SELECT '12237','12198', UNION ALL
SELECT '12238','12199', UNION ALL
SELECT '12239','12200', UNION ALL
SELECT '12240','12201', UNION ALL
SELECT '12241','12202', UNION ALL
SELECT '12242','12203', UNION ALL
SELECT '12243','12204', UNION ALL
SELECT '12244','12205', UNION ALL
SELECT '12245','12206', UNION ALL
SELECT '12246','12207', UNION ALL
SELECT '12247','12208', UNION ALL
SELECT '12248','12209', UNION ALL
SELECT '12249','12210', UNION ALL
SELECT '12250','12211', UNION ALL
SELECT '12251','12212', UNION ALL
SELECT '12252','12213', UNION ALL
SELECT '12253','12214', UNION ALL
SELECT '12254','12215', UNION ALL
SELECT '12255','12216', UNION ALL
SELECT '12256','12217', UNION ALL
SELECT '12257','12218', UNION ALL
SELECT '12258','12219', UNION ALL
SELECT '12259','12220', UNION ALL
SELECT '12260','12221', UNION ALL
SELECT '12261','12222', UNION ALL
SELECT '12262','12223', UNION ALL
SELECT '12263','12224', UNION ALL
SELECT '12264','12225', UNION ALL
SELECT '12265','12226', UNION ALL
SELECT '12266','12227', UNION ALL
SELECT '12267','12228', UNION ALL
SELECT '12268','12229', UNION ALL
SELECT '12269','12230', UNION ALL
SELECT '12270','12231', UNION ALL
SELECT '12271','12232', UNION ALL
SELECT '12272','12233', UNION ALL
SELECT '12273','12234', UNION ALL
SELECT '12274','12235', UNION ALL
SELECT '12275','12236', UNION ALL
SELECT '12276','12237', UNION ALL
SELECT '12277','12238', UNION ALL
SELECT '12278','12239', UNION ALL
SELECT '12279','12240', UNION ALL
SELECT '12280','12241', UNION ALL
SELECT '12281','12242', UNION ALL
SELECT '12282','12243', UNION ALL
SELECT '12283','12244', UNION ALL
SELECT '12284','12245', UNION ALL
SELECT '12285','12246', UNION ALL
SELECT '12286','12247', UNION ALL
SELECT '12287','12248', UNION ALL
SELECT '12288','12249', UNION ALL
SELECT '12289','12250', UNION ALL
SELECT '12290','12251', UNION ALL
SELECT '12291','12252', UNION ALL
SELECT '12292','12253', UNION ALL
SELECT '12293','12254', UNION ALL
SELECT '12294','12255', UNION ALL
SELECT '12295','12256', UNION ALL
SELECT '12296','12257', UNION ALL
SELECT '12297','12258', UNION ALL
SELECT '12298','12259', UNION ALL
SELECT '12299','12260', UNION ALL
SELECT '12300','12261', UNION ALL
--Data for LeadContact (email address's modified to protect the innocent)
--LeadContact table data
SELECT 'megan_erskine2000@ere.idk','12162', UNION ALL
SELECT 'ouraunt@bcd.idk','12163', UNION ALL
SELECT 'rkw1951@verizon.lol','12164', UNION ALL
SELECT 'kdkcmbrooks@sbcglobal.lol','12165', UNION ALL
SELECT 'nedifauber@ere.idk','12166', UNION ALL
SELECT 'davespecian@seesouth.lol','12167', UNION ALL
SELECT 'wileyric@ere.idk','12168', UNION ALL
SELECT 'twoby2wo@bcd.idk','12169', UNION ALL
SELECT 'gena.blanco@gmail.idk','12170', UNION ALL
SELECT 'Sharona54@sbcglobal.lol','12171', UNION ALL
SELECT 'higenflick1@bcd.idk','12172', UNION ALL
SELECT 'gmiller6436@idkcast.lol','12173', UNION ALL
SELECT 'freashfreeze@ere.idk','12174', UNION ALL
SELECT 'riwillia@wyoming.idk','12175', UNION ALL
SELECT 'roberthayes80@ere.idk','12176', UNION ALL
SELECT 'nenapeg@sbcglobal.lol','12177', UNION ALL
SELECT 'hakeem192004@ere.idk','12178', UNION ALL
SELECT 'jhkneupper@sabglobal.lol','12179', UNION ALL
SELECT 'cutiepie963407@ere.idk','12180', UNION ALL
SELECT 'prem.sharma999@googlemail.idk','12181', UNION ALL
SELECT 'IbePeanutty@bcd.idk','12182', UNION ALL
SELECT 'lisnowman@bcd.idk','12183', UNION ALL
SELECT 'lisagshd@hotmail.idk','12184', UNION ALL
SELECT 'pjsingh1977@ere.idk','12185', UNION ALL
SELECT 'ijem54@ere.idk','12186', UNION ALL
SELECT 'bjhunt72000@ere.idk','12187', UNION ALL
SELECT 'ijem54@ere.idk','12188', UNION ALL
SELECT 'ijem54@ere.idk','12189', UNION ALL
SELECT 'jkadetz@trover.not','12190', UNION ALL
SELECT 'ljl3401@idkcast.lol','12191', UNION ALL
SELECT 'bjhunt72000@ere.idk','12192', UNION ALL
SELECT 'rickeydevore@seesouth.lol','12193', UNION ALL
SELECT 'bwbacon@hotmail.idk','12194', UNION ALL
SELECT 'ltchief10@ere.idk','12195', UNION ALL
SELECT 'jdarla64@bcd.idk','12196', UNION ALL
SELECT 'tbilek@bcd.idk','12197', UNION ALL
SELECT 'tbilek@bcd.idk','12198', UNION ALL
SELECT 'rhess1119q@bcd.idk','12199', UNION ALL
SELECT 'lrossiemb@bcd.idk','12200', UNION ALL
SELECT 'gwenpiland@bcd.idk','12201', UNION ALL
SELECT 'chanthini91@ere.idk','12202', UNION ALL
SELECT 'jacquelineford18@bcd.idk','12203', UNION ALL
SELECT 'foxfox96@bcd.idk','12204', UNION ALL
SELECT 'shermansen@remaxencore.idk','12205', UNION ALL
SELECT 'brown32foxy@bcd.idk','12206', UNION ALL
SELECT 'larry@island-realestate.idk','12207', UNION ALL
SELECT 'brucegrimbly@bcd.idk','12208', UNION ALL
SELECT 'dheez57@sbcglobal.lol','12209', UNION ALL
SELECT 'hernandezaraceli29@ere.idk','12210', UNION ALL
SELECT 'ganndahl@seesouth.lol','12211', UNION ALL
SELECT 'VANITYSHADE@bcd.idk','12212', UNION ALL
SELECT 'carol.trinidad@360mortgagegroup.idk','12213', UNION ALL
SELECT 'fordguy12@ere.idk','12214', UNION ALL
SELECT 'sears_lucas@hotmail.idk','12215', UNION ALL
SELECT 'ammwhite0176@hotmail.idk','12216', UNION ALL
SELECT 'nightwingstx@ere.idk','12217', UNION ALL
SELECT 'Pamjoy3@idkcast.lol','12218', UNION ALL
SELECT 'oceanaction2@mweraq.not','12219', UNION ALL
SELECT 'jfarmer40@ere.idk','12220', UNION ALL
SELECT 'otravel@att.lol','12221', UNION ALL
SELECT 'dee.pickett@ere.idk','12222', UNION ALL
SELECT 'bigbikerbaker@ere.idk','12223', UNION ALL
SELECT 'jfarmer40@ere.idk','12224', UNION ALL
SELECT 'tpalmer9@optonline.idk','12225', UNION ALL
SELECT 'bibzayd7@ere.idk','12226', UNION ALL
SELECT 'ammwhite0176@hotmail.idk','12227', UNION ALL
SELECT 'nightwingstx@ere.idk','12228', UNION ALL
SELECT 'Pamjoy3@idkcast.lol','12229', UNION ALL
SELECT 'oceanaction2@mweraq.not','12230', UNION ALL
SELECT 'sears_lucas@hotmail.idk','12231', UNION ALL
SELECT 'b_asse@ere.fr','12232', UNION ALL
SELECT 'l.gallaher@insightbb.idk','12233', UNION ALL
SELECT 'fordguy12@ere.idk','12234', UNION ALL
SELECT 'preschooljami@ere.idk','12235', UNION ALL
SELECT 'bu_x_2t@hotmail.idk','12236', UNION ALL
SELECT 'adelsayegh@optonline.lol','12237', UNION ALL
SELECT 'bunnylancer@hotmail.idk','12238', UNION ALL
SELECT 'mccain_jacquelin@ere.idk','12239', UNION ALL
SELECT 'maggie2413@gmail.idk','12240', UNION ALL
SELECT 'susanmjamieson@ere.idk','12241', UNION ALL
SELECT 'JMORRIS@ere.idk','12242', UNION ALL
SELECT 'gail_burton@ere.idk','12243', UNION ALL
SELECT 'attnytobe@gmail.idk','12244', UNION ALL
SELECT 'b-wild_87@hotmail.idk','12245', UNION ALL
SELECT 'samuel49@OPTONLINE.lol','12246', UNION ALL
SELECT 'KarenLLew1@bcd.idk','12247', UNION ALL
SELECT 'darinbontje@charter.lol','12248', UNION ALL
SELECT 'kathazar@bcd.idk','12249', UNION ALL
SELECT 'carolyn535@msn.idk','12250', UNION ALL
SELECT 'TBHMAH2@bcd.idk','12251', UNION ALL
SELECT 'DAVID.ROSS@BESTBUY.idk','12252', UNION ALL
SELECT 'fawkesracinginc@ere.idk','12253', UNION ALL
SELECT 'darylebigelow@att.lol','12254', UNION ALL
SELECT 'saubuchon@att.lol','12255', UNION ALL
SELECT 'rbarnes59@knology.lol','12256', UNION ALL
SELECT 'harne6@hotmail.idk','12257', UNION ALL
SELECT 'caseycausey19@ere.idk','12258', UNION ALL
SELECT 'rcatoc7963@sbcglobal.lol','12259', UNION ALL
SELECT 'kathazar@bcd.idk','12260', UNION ALL
SELECT 'pcwhy628@gmail.idk','12261', UNION ALL
--Stripped query that show duplicates
select top 1000
lc.email,
lc.leadcontactid,
l.leadid
from lead l
join leadcontact lc
on l.leadcontactid = lc.leadcontactid
order by email
--Results from query
--Results of query
SELECT '------------@ere.idk','64522','64559', UNION ALL
SELECT '----@ere.idk','830227','38744885', UNION ALL
SELECT '----@ere.idk','830230','38745090', UNION ALL
SELECT '-garci@ere.idk','124137','124174', UNION ALL
SELECT '-garci@ere.idk','124225','124262', UNION ALL
SELECT '-garci@ere.idk','118319','118356', UNION ALL
SELECT '-garci@ere.idk','118320','118357', UNION ALL
SELECT '-grnt_messer@ere.idk','293045','1545471', UNION ALL
SELECT '-grnt_messer@ere.idk','283703','1230093', UNION ALL
SELECT '-j-lopez10@live.idk','781567','29978544', UNION ALL
SELECT '-j-lopez10@live.idk','781569','29978732', UNION ALL
SELECT '-j-lopez10@live.idk','786816','30942264', UNION ALL
SELECT '-j-lopez10@live.idk','787337','30960853', UNION ALL
SELECT '............kiram0219@ere.idk','757459','28531938', UNION ALL
SELECT '.@msn.idk','420410','6740959', UNION ALL
SELECT '.abby@altelco.idk','934358','46686550', UNION ALL
SELECT '.amyj@hargray.idk','264939','820926', UNION ALL
SELECT '.ayagoolu@ere.idkm','283078','1211329', UNION ALL
SELECT '.baberyann@bcd.idk','314266','2285466', UNION ALL
SELECT '.bbredin@wercove.not','378626','5370143', UNION ALL
SELECT '.bbredin@wercove.not','378628','5370156', UNION ALL
SELECT '.bbredin@wercove.not','378629','5370160', UNION ALL
SELECT '.bbredin@wercove.not','378630','5370167', UNION ALL
SELECT '.bbredin@wercove.not','378631','5370172', UNION ALL
SELECT '.bbredin@wercove.not','386729','5674978', UNION ALL
SELECT '.bbredin@wercove.not','387083','5677897', UNION ALL
SELECT '.bbredin@wercove.not','387174','5678584', UNION ALL
SELECT '.bbredin@wercove.not','387273','5679143', UNION ALL
SELECT '.bbredin@wercove.not','387625','5682466', UNION ALL
SELECT '.bbredin@wercove.not','370607','5023674', UNION ALL
SELECT '.beghfg@seesouth.lol','956964','47776620', UNION ALL
SELECT '.berflem@bcd.idk','856354','41280259', UNION ALL
SELECT '.berflem@bcd.idk','845218','40398090', UNION ALL
SELECT '.bernie06c@bcd.idk','417997','6656634', UNION ALL
SELECT '.blotshaw@insightbb.idk','388326','5712308', UNION ALL
SELECT '.busdriver_144@hotmail.idk','828051','38484387', UNION ALL
SELECT '.busdriver_144@hotmail.idk','828052','38484388', UNION ALL
SELECT '.cghughes395@bcd.idk','87352','87389', UNION ALL
SELECT '.cghughes395@bcd.idk','99113','99150', UNION ALL
SELECT '.chdeter@gmail.idk','788939','31236267', UNION ALL
SELECT '.cherrypie0608@ere.idk','858085','41519910', UNION ALL
SELECT '.cherrypie0608@ere.idk','859032','41605153', UNION ALL
SELECT '.cherrypie0608@ere.idk','868831','42394189', UNION ALL
SELECT '.circuit2perfect@ere.idk','894073','44783569', UNION ALL
SELECT '.circuit2perfect@ere.idk','885568','43897338', UNION ALL
SELECT '.cosebes@gbta.idk','650858','21159995', UNION ALL
SELECT '.cosebes@gbta.idk','659588','21713771', UNION ALL
SELECT '.daughertyfred@bcd.idk','505042','9850354', UNION ALL
SELECT '.daughertyfred@bcd.idk','494917','9146036', UNION ALL
SELECT '.davidsblack23@ere.idk','393052','5842671', UNION ALL
SELECT '.davidsblack23@ere.idk','393053','5842677', UNION ALL
SELECT '.davidsblack23@ere.idk','403325','6188248', UNION ALL
SELECT '.davidsblack23@ere.idk','403345','6188440', UNION ALL
SELECT '.davmg@bcd.idk','626288','19208983', UNION ALL
SELECT '.davmg@bcd.idk','626804','19219762', UNION ALL
SELECT '.davmg@bcd.idk','618755','18607977', UNION ALL
SELECT '.davmg@bcd.idk','618758','18607986', UNION ALL
SELECT '.dkpdp1@gmail.idk','622916','18950078', UNION ALL
SELECT '.dlalowski@bcd.idk','716957','25283280', UNION ALL
SELECT '.dlalowski@bcd.idk','723311','25759123', UNION ALL
SELECT '.doodleypook@ere.idk','551481','13067900', UNION ALL
SELECT '.doodleypook@ere.idk','544393','12453753', UNION ALL
SELECT '.drider2007@windstream.lol','934222','46683157', UNION ALL
SELECT '.drider2007@windstream.lol','934233','46683590', UNION ALL
SELECT '.drider2007@windstream.lol','934234','46683599', UNION ALL
SELECT '.dwimmer31@ere.idk','721181','25560109', UNION ALL
SELECT '.dwimmer31@ere.idk','708712','24748327', UNION ALL
SELECT '.dwimmer31@ere.idk','714475','25145638', UNION ALL
SELECT '.ejbeepthefaith@bcd.idk','628010','19320180', UNION ALL
SELECT '.ejbeepthefaith@bcd.idk','633266','20226453', UNION ALL
SELECT '.eparadise2@ere.idk','39289','39326', UNION ALL
SELECT '.EVANS_RICKY@seeSOUTH.lol','145086','145123', UNION ALL
SELECT '.finewoodwork@ere.idk','847170','40521546', UNION ALL
SELECT '.finewoodwork@ere.idk','847416','40532279', UNION ALL
SELECT '.fukueihsieh@hotmail.idk','613633','18212389', UNION ALL
SELECT '.g.arsen81@ere.idk','378155','5350953', UNION ALL
SELECT '.g.arsen81@ere.idk','395025','5901214', UNION ALL
SELECT '.g.arsen81@ere.idk','385754','5643612', UNION ALL
SELECT '.gg57@bcd.idk','608873','17849265', UNION ALL
SELECT '.gg57@bcd.idk','601223','17155864', UNION ALL
SELECT '.ginotioinderby@bcd.idk','954154','47673088', UNION ALL
SELECT '.gonzalez1943@seesouth.lol','261793','740624', UNION ALL
SELECT '.gonzalez1943@seesouth.lol','261794','740739', UNION ALL
SELECT '.gonzalez1943@seesouth.lol','271248','982912', UNION ALL
SELECT '.gonzalez1943@seesouth.lol','271705','986493', UNION ALL
SELECT '.gpdukes7@bcd.idk','279372','1147237', UNION ALL
SELECT '.haineshawk@ere.idk','12924','12963', UNION ALL
SELECT '.ironklem@ere.idk','206738','206852', UNION ALL
SELECT '.ironklem@ere.idk','216914','217042', UNION ALL
SELECT '.jabchico@bcd.idk','587774','16202102', UNION ALL
SELECT '.jc@ere.idk','381505','5488838', UNION ALL
SELECT '.jerry12@yohoo.idk','588340','16263438', UNION ALL
SELECT '.jerry12@yohoo.idk','588341','16263441', UNION ALL
SELECT '.jerry12@yohoo.idk','588338','16263435', UNION ALL
SELECT '.jerry12@yohoo.idk','595090','16693022', UNION ALL
SELECT '.jerry12@yohoo.idk','595484','16700083', UNION ALL
SELECT '.jimann@allianceidk.lol','805080','34642408', UNION ALL
SELECT '.jimann@allianceidk.lol','805158','34647152', UNION ALL
SELECT '.jlriley96@bcd.idk','884247','43739173', UNION ALL
SELECT '.joeldeb1026@bcd.idk','918966','46114755', UNION ALL
--Dersired resuts
distinct email address, max(leadid)
jimann@allianceidk.lol', 34647152
jerry12@yohoo.idk',16700083
ironklem@ere.idk',217042
Viewing 7 posts - 1 through 6 (of 6 total)
You must be logged in to reply to this topic. Login to reply