courtney79
Technical User
Hi,
I am having trouble removing distinct records from the follwowing data:
Supporter email BounceBacks
1 bob@top.com 0
1 bob2@top.com 2
2 sam@fop.com 1
3 jane@lop.com 0
4 dave@pol.com 0
What I am hoping to get is get every supporters email but if they have more than one email I want the one with least bounce backs e.g.
Supporter email BounceBacks
1 bob@top.com 0
2 sam@fop.com 1
3 jane@lop.com 0
4 dave@pol.com 0
The SQL I am using at the moment is the following:
SELECT distinct supporter, email, MIN(ISNULL(BounceBacks,0)) as BounceBacks
FROM emailtable
GROUP BY supporter, email
but that still gives me all of them which i guess is because it is looking at distinct combinations as opposed to only supporters!
Any help would be much appreciated.
Cheers,
Tom
I am having trouble removing distinct records from the follwowing data:
Supporter email BounceBacks
1 bob@top.com 0
1 bob2@top.com 2
2 sam@fop.com 1
3 jane@lop.com 0
4 dave@pol.com 0
What I am hoping to get is get every supporters email but if they have more than one email I want the one with least bounce backs e.g.
Supporter email BounceBacks
1 bob@top.com 0
2 sam@fop.com 1
3 jane@lop.com 0
4 dave@pol.com 0
The SQL I am using at the moment is the following:
SELECT distinct supporter, email, MIN(ISNULL(BounceBacks,0)) as BounceBacks
FROM emailtable
GROUP BY supporter, email
but that still gives me all of them which i guess is because it is looking at distinct combinations as opposed to only supporters!
Any help would be much appreciated.
Cheers,
Tom