解决中记录重复问题

<script type="text/javascript"><!-- google_ad_client = "pub-2947489232296736"; /* 728x15, 创建于 08-4-23MSDN */ google_ad_slot = "3624277373"; google_ad_width = 728; google_ad_height = 15; //--> </script> <script type="text/javascript" src="http://pagead2.googlesyndication.com/pagead/show_ads.js"> </script>
<script type="text/javascript"><!-- google_ad_client = "pub-2947489232296736"; /* 160x600, 创建于 08-4-23MSDN */ google_ad_slot = "4367022601"; google_ad_width = 160; google_ad_height = 600; //--> </script><script type="text/javascript" src="http://pagead2.googlesyndication.com/pagead/show_ads.js"> </script>
解决数据库中记录重复问题(By:aloxy)Jul22,11:19--产品数据重复统计SELECTmc,userid,COUNT(mc)ASExpr1FROMchanpinGROUPBYmc,userid--将不重复的纪录插入新表newchanpinselect*into#Tmp1fromchanpingoselectmin(ID)asautoIDinto#Tmp2from#Tmp1groupbymc,useridgoselect*intonewchanpinfrom#Tmp1whereIDin(selectautoIDfrom#tmp2)--查找重复用户--selectdistinctnamefromuser_nameselect*into#Tmp0fromuser_namegoselectmin(ID)asautoIDinto#Tmp6from#Tmp0groupbyadmingoselect*intonewuser_namefrom#Tmp0whereIDin(selectautoIDfrom#tmp6)--用户自定义类别SELECTuserlbASExpr1,useridASExpr2,COUNT(userlb)ASExpr3FROMnewuser_lbGROUPBYuserlb,useridselect*into#Tmp8fromuser_lbgoselectmin(ID)asautoIDinto#Tmp9from#Tmp8groupbyuserlb,useridgoselect*intonewuser_lbfrom#Tmp8whereIDin(selectautoIDfrom#tmp9)--用户新闻selectbt,userid,count(bt)fromuser_newsgroupbybt,useridselect*into#Tmp88fromuser_newsgoselectmin(ID)asautoIDinto#Tmp99from#Tmp88groupbybt,useridgoselect*intonewuser_newsfrom#Tmp88whereIDin(selectautoIDfrom#tmp99) <script type="text/javascript"><!-- google_ad_client = "pub-2947489232296736"; /* 728x15, 创建于 08-4-23MSDN */ google_ad_slot = "3624277373"; google_ad_width = 728; google_ad_height = 15; //--> </script> <script type="text/javascript" src="http://pagead2.googlesyndication.com/pagead/show_ads.js"> </script>
<script type="text/javascript"><!-- google_ad_client = "pub-2947489232296736"; /* 160x600, 创建于 08-4-23MSDN */ google_ad_slot = "4367022601"; google_ad_width = 160; google_ad_height = 600; //--> </script><script type="text/javascript" src="http://pagead2.googlesyndication.com/pagead/show_ads.js"> </script>
阅读更多
文章标签: 数据库 bt 产品
个人分类: 数据库
上一篇一个有趣的SQL问题。
下一篇Rman操作简单分析
想对作者说点什么? 我来说一句

没有更多推荐了,返回首页

关闭
关闭
关闭