Group 原则

  select 后面的所有劣种,没有使用聚合函数的列,必须出现在 group by 后面,比如下面的例子

insert into #temp_move2     
      select agent_code, count(1)
          from #temp_move
      group by agent_code 

对#temp_move临时表中的agent_code 进行分组,去除 agent_code和同一agent_code出现的次数插入到 #temp_move2表中。

posted on 2014-01-15 14:36  信平  阅读(150)  评论(0编辑  收藏  举报