Today i am going to discuss a very common problem that takes too much time of developers to write code and find soution
Problem: How can i find duplicate and return values from table data
Solution: Using SQL Server following is the example to find duplicating values.
create table repeatCheck
(id int identity(1,1),
email varchar(50));
insert into repeatCheck values ('shamas@isl.com');
insert into repeatCheck values ('shamas@isl.com');
insert into repeatCheck values ('maria@isl.com');
insert into repeatCheck values ('azher@isl.com');
insert into repeatCheck values ('khawar@isl.com');
insert into repeatCheck values ('khalil@isl.com');
insert into repeatCheck values ('maria@isl.com');
select * from repeatCheck
--- Now return all repeating emails
select email,count(email) as emailcount
from repeatCheck
group by email
having count(email) > 1
As you can see how simple is to return duplicate values for different email addresses
1 comment:
Thanks
Post a Comment