I have a table where some of the data are repeating. I need to copy the repeated values from the table to a new table.
Need an sql query to do this
Know the answer? Post it. Somebody with the same question will find it here.
Answer a question in the forums and earn +20 SHARP for every answer.
See unanswered questions
DevSocialUpcoming · 3rd editionAI Agents ConferenceDec 1–3, 2026Live onlineFree to attend5days leftRegister
Adinarayana Reddy JcRank #7,298 · 244 reputationPosted May 8, 2015, 3:12 AM EDT
try this one.
create table tbl_demo(Id int,Name varchar(50))
create table tbl_demo1(Id int,Name varchar(50))
insert into tbl_demo values(1,'adi')
insert into tbl_demo values(1,'adi')
insert into tbl_demo values(1,'adi')
insert into tbl_demo values(1,'ravi')
INSERT INTO tbl_demo1 SELECT Id,Name FROM tbl_demo GROUP BYId,Name HAVINGCOUNT(1) > 1