select *  from  test

select ( case when len(id)>20 then name else id end ) name ,金额,数量 from
(
SELECT name, isnull(id,'汇总') as id, sum(金额) 金额 , SUM(数量) 数量 from
(
select *, cast(newid() as varchar(60)) as id from test) a
group BY name,id with CUBE

) b
where name is not null

分组汇总

转载于:https://www.cnblogs.com/qanholas/archive/2011/09/01/2161879.html

相关文章:

  • 2021-12-13
  • 2022-02-21
  • 2021-08-04
  • 2022-12-23
  • 2022-12-23
  • 2021-09-27
猜你喜欢
  • 2021-07-19
  • 2021-12-31
  • 2021-06-08
  • 2021-12-18
  • 2021-10-03
  • 2022-12-23
  • 2022-02-15
相关资源
相似解决方案