日期:2014-05-16 浏览次数:20422 次
select '单据' name,sum(amount) amount1,'元' type,'q' sort
from FINANCE_CHECK_MNG where modeltype='project_model' and createtime >= '2014-01-01 0:00:00' and createtime <='2014-12-31 0:00:00'
union
select '单据' name,sum(amount) amount2,'元' type,'q' sort
from FINANCE_CHECK_MNG where modeltype='project_model' and createtime >= '2012-12-01 0:00:00' and createtime <='2012-12-31 0:00:00'
select a.[name],('当前年:'+a.amount1+'/当前月:'+b.amount2) as amount1,a.[type],a.sort
from
(
select '单据' name,sum(amount) amount1,'元' type,'q' sort
from FINANCE_CHECK_MNG where modeltype='project_model' and createtime >= '2014-01-01 0:00:00' and createtime <='2014-12-31 0:00:00'
) a left join
(
select '单据' name,sum(amount) amount2
from FINANCE_CHECK_MNG where modeltype='project_model' and createtime >= '2012-12-01 0:00:00' and createtime <='2012-12-31 0:00:00'
) b on a.[name]=b.[name]