Troubleshoot duplicate records in a database

Source: Internet
Author: User
Resolve | data | database | problem | Repeat the problem in the database (by:aloxy) June 22, 11:19-Product data duplication Select MC, UserID, COUNT (MC) as Expr1from Chanpingroup by MC, userid--inserts the record of the new table Newchanpinselect * into #Tmp1 from Chanpingoselect min (ID) as autoid into #Tmp2 from #Tmp1 Group B Y MC, Useridgoselect * into Newchanpin from #Tmp1 where ID in (select Autoid from #tmp2)--Find duplicate users--select distinct name from User_nameselect * into #Tmp0 the user_namegoselect min (ID) as autoid into #Tmp6 from #Tmp0 GROUP by Admingoselect * into Newuser_name from #Tmp0 where ID in (select Autoid from #tmp6)-User-defined category Select Userlb as EXPR1, userid as EXPR2, COUNT (user LB) as Expr3from newuser_lbgroup by USERLB, Useridselect * to #Tmp8 from User_lbgoselect min (ID) as autoid into #Tmp9 fr Om #Tmp8 GROUP BY USERLB, Useridgoselect * to newuser_lb from #Tmp8 where ID in (select Autoid from #tmp9)--User News Select BT , Userid,count (BT) from User_news GROUP by Bt,useridselect * to #Tmp88 from User_newsgoselect min (ID) as autoid into #Tm P99 from #Tmp88 GROUP by Bt,useridgoselect * into Newuser_news from #Tmp88 where ID in (select Autoid from #tmp99)

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.