|
马上注册,结交更多好友,享用更多功能,让你轻松玩转社区。
您需要 登录 才可以下载或查看,没有账号?注册账号
×
SELECT GL_BALANCE.ASSID AS "客商ID",
/* sum(case when GL_BALANCE.period = 0 then GL_BALANCE.debitamount else 0 end) AS"1",
sum(case when GL_BALANCE.period<>0 then GL_BALANCE.debitamount else 0 end) AS"2",*//*这两条不对先注视掉*/
GL_BALANCE.debitamount AS "原币借发生额",
GL_BALANCE.creditamount AS"原币贷发生额",
GL_BALANCE.period AS "会计期间",
GL_BALANCE.year AS"年",
bd_accsubj.subjcode AS "科目编码",
bd_accsubj.subjname AS "科目名称",
bd_cubasdoc.custname AS"客商名称",bd_cubasdoc.custcode AS"客商编码"
FROM GL_BALANCE
left join bd_accsubj on GL_BALANCE.pk_accsubj = bd_accsubj.pk_accsubj
left join gl_fixtmpfreevalue on GL_BALANCE.assid =
gl_fixtmpfreevalue.assid
left join bd_cubasdoc on gl_fixtmpfreevalue.code2 = bd_cubasdoc.custcode
WHERE GL_BALANCE.pk_accsubj in /*查询1100301 三分公司机关的科目1134,1135,1136三个科目的PK*/
(select pk_accsubj
from bd_accsubj
where subjcode in
(select subjcode
from bd_accsubj
where pk_glorgbook =
(select pk_glorgbook
from bd_glorgbook
where glorgbookcode = '11003001-0002')
AND endflag = 'Y'
AND (subjcode LIKE '1134%' OR subjcode LIKE '1135%' OR
subjcode LIKE '1136%')
)
and pk_glorgbook =
(select pk_glorgbook
from bd_glorgbook
where glorgbookcode = '11003001-0002'))
and GL_BALANCE.pk_corp =/*公司*/
(select pk_corp from bd_corp where unitcode = '11003001')
and year = '2018'/*年份,月份没有写*/
/* AND GL_BALANCE.period = 0* *//* 00为期初,现在注视掉*/
/*GROUP BY GL_BALANCE.ASSID, bd_accsubj.subjname*//*这个分组报错*/
|
|