怎么根据已有的科目、客商、项目单独选出一条查出需要的数据,例如,选择场地租赁,显示的都是所有场地租赁的数据,但是我选了一个,报错,列名无效,另外这三个是和部门联动的select 科目,客商,项目,sum((case when 表='T1' then 预收 else 0 end ) ) 预收,sum((case when 表='T1' then 冲销 else 0 end )) 冲销,sum((case when 表='T2' then 预收 else 0 end ) ) 赊销,sum((case when 表='T2' then 冲销 else 0 end ) ) 收款 from ( select 'T1' 表,科目,客商,项目,yskje 预收,cxje 冲销 from ( select (select name from uf_bd_account where uf_bd_account.id=d.km) 科目, (select name from uf_bd_cust_supplier where uf_bd_cust_supplier.id=d.khmc) 客商, (select project_name from uf_bd_project where uf_bd_project.id=d.xm) 项目, yskje,cxje from uf_gl_voucher_dt1 d where mainid in(select id from uf_gl_voucher where 1=1${if(len(bumen) == 0,""," and orgcode in (" + bumen + ")")}${if(len(starttime)=0,""," and prepareddate>='"+starttime+"'")}${if(len(endtime)=0,""," and prepareddate<='"+endtime+"'")} ))xwhere 1=1${if(len(km) == 0,""," and 科目 in (" + km + ")")}${if(len(ks) == 0,""," and 客商 in (" + ks + ")")}${if(len(xm) == 0,""," and 项目 in (" + xm + ")")} union all select 'T2',科目,客商,项目,sxje 赊销 ,skjine 收款 from ( select (select name from uf_bd_account where uf_bd_account.id=d.kem) 科目, (select name from uf_bd_cust_supplier where uf_bd_cust_supplier.id=d.keh) 客商, (select project_name from uf_bd_project where uf_bd_project.id=d.xiangm) 项目, sxje,skjine from uf_gl_voucher_dt2 d where mainid in(select id from uf_gl_voucher where 1=1${if(len(bumen) == 0,""," and orgcode in (" + bumen + ")")}${if(len(starttime)=0,""," and prepareddate>='"+starttime+"'")}${if(len(endtime)=0,""," and prepareddate<='"+endtime+"'")} ))xwhere 1=1${if(len(km) == 0,""," and 科目 in (" + km + ")")}${if(len(ks) == 0,""," and 客商 in (" + ks + ")")}${if(len(xm) == 0,""," and 项目 in (" + xm + ")")})x group by 科目,客商,项目这是数据集