Hi, Sorry this is not possible at the moment. There is a feature request already, but it will take some time until this is available. A workaround is:
select xm, sum from( select '' o, '总计' xm, sum(je) sum from #t union all select col1 o, col1, sum(je) from #t group by col1 union all select col1 || col2 o, ' ' || col2 xm, sum(je) from #t group by o, xm) order by o, xm desc; This should work for all databases. Regards, Thomas 2008/10/27 jyk <[EMAIL PROTECTED]>: > > --example in sql server 2000 > > --prepare data > drop table #t > > create table #t > ( > col1 char(255), > col2 char(255), > je numeric(19,2) > ) > insert into #t select 'K55', 'K5506', 1234 > insert into #t select 'K55', 'K5507', 4321 > insert into #t select 'K56', 'K5601', 3333 > insert into #t select 'K56', 'K5602', 6666 > > --report > select > case > when (grouping(col1)=1) then '总计' > else > case > when (grouping (col2) = 1 ) then > isnull(rtrim(col1),'') > else space(1*4)+isnull(rtrim(col2),'') > end > end as xm, > > sum(je) > > from #t > group by col1, col2 with rollup > order by grouping(col1) desc, col1, grouping(col2) desc, col2 > > --result > 总计 15554.00 > K55 5555.00 > K5506 1234.00 > K5507 4321.00 > K56 9999.00 > K5601 3333.00 > K5602 6666.00 > > > > --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "H2 Database" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/h2-database?hl=en -~----------~----~----~----~------~----~------~--~---
