insert into a(art,hits) select top 10 art,hits from b order by hits desc实现的功能是把b表的点击前十条记录复制到a表,如果点击数都不一样没有问题
如果b表的点击都为0的话,复制过去的就是把所有的记录,不止10条了
要怎么样才能前十条???
如果b表的点击都为0的话,复制过去的就是把所有的记录,不止10条了
要怎么样才能前十条???
调试欢乐多
insert into a(art,hits) select top 10 art,hits from b order by hits desc
else
insert into a(art,hits) select art,hits from b
加上列art 一起排序就可以解决
insert into a(art,hits) select top 10 art,hits from b order by hits desc,art