时间: 2021-08-13 作者:daque
--产物数据反复统计 select mc, userid, count(mc) as expr1 from chanpin group by mc, userid --将不反复的记录插入新表newchanpin select * into #tmp1 from chanpin go select min(id) as autoid into #tmp2 from #tmp1 group by mc, userid go select * into newchanpin from #tmp1 where id in(select autoid from #tmp2) --搜索反复用户 --select distinct name from user_name select * into #tmp0 from user_name go select min(id) as autoid into #tmp6 from #tmp0 group by admin go select * into newuser_name from #tmp0 where id in(select autoid from #tmp6) --用户自设置类型 select userlb as expr1, userid as expr2, count(userlb) as expr3 from newuser_lb group by userlb, userid select * into #tmp8 from user_lb go select min(id) as autoid into #tmp9 from #tmp8 group by userlb, userid go select * into newuser_lb from #tmp8 where id in(select autoid from #tmp9) --用户消息 select bt, userid,count(bt) from user_news group by bt,userid select * into #tmp88 from user_news go select min(id) as autoid into #tmp99 from #tmp88 group by bt,userid go select * into newuser_news from #tmp88 where id in(select autoid from #tmp99)