日期:2014-05-17 浏览次数:20636 次
select a.MNAME,
max(a.MSTANDARD) 'MSTANDARD',
max(a.MUNIT) 'MUNIT',
max(a.COUNTONE) 'COUNTONE',
max(a.FEEONE) 'FEEONE',
sum(a.COUNTTWO) 'COUNTTWO',
sum(a.FEETWO) 'FEETWO',
max(a.COUNTTHREE) 'COUNTTHREE',
max(a.FEETHREE) 'FEETHREE',
max(a.COUNTONE)+sum(a.COUNTTWO)-max(a.COUNTTHREE) 'COUNTFOUR',
max(a.FEEONE)+sum(a.FEETWO)-max(a.FEETHREE) 'FEEFOUR'
from [表名] a
group by a.MNAME
select
a.MNAME,
max(a.MSTANDARD) "MSTANDARD",
max(a.MUNIT) "MUNIT",
max(a.COUNTONE) "COUNTONE",
max(a.FEEONE) "FEEONE",
SUM(a.COUNTTWO) "COUNTTWO",
SUM(a.FEETWO) "FEETWO",
max(a.COUNTTHREE) "COUNTTHREE",
max(a.FEETHREE) "FEETHREE",
SUM(a.COUNTONE + a.COUNTTWO - a.COUNTTHREE) "COUNTFOUR",
SUM(a.FEEONE + a.FEETWO - a.FEETHREE) "FEEFOUR"
from [表名] a
group by a.MNAME