这段写在sql函数里面怎么写

select

count(1) as 户主数量

from

(

select 

op1.wgbm,

op1.xm,

op1.sfzh,

op1.yhzgx,

op1.zhbh,

concat(op2.ldh,op2.dyh,op2.fh) as fwbh

from

member_info op1 left join house_info op2 on op1.wgbm = op2.wgbm  and op1.zhbh = concat(op2.ldh,op2.dyh,op2.fh)

where op2.wgbm is not null

) a

where a.wgbm =  '${G2}' and a.yhzgx = '户主' 

FineReport 123木头人1 发布于 2022-6-8 11:28
1min目标场景问卷 立即参与
回答问题
悬赏:3 F币 + 添加悬赏
提示:增加悬赏、完善问题、追问等操作,可使您的问题被置顶,并向所有关注者发送通知
共2回答
最佳回答
0
CD20160914Lv8专家互助
发布于2022-6-8 11:33

sql("FRDemo","

select

count(1) as 户主数量

from

(

select 

op1.wgbm,

op1.xm,

op1.sfzh,

op1.yhzgx,

op1.zhbh,

concat(op2.ldh,op2.dyh,op2.fh) as fwbh

from

member_info op1 

left join house_info op2 on op1.wgbm = op2.wgbm  

and op1.zhbh = concat(op2.ldh,op2.dyh,op2.fh)

where op2.wgbm is not null

) a

where a.wgbm ='"+G2+"' and a.yhzgx = '户主'",1,1)

最佳回答
0
重庆一棵草Lv4中级互助
发布于2022-6-8 11:29(编辑于 2022-6-8 11:31)

SQL("数据库","select count(1) as 户主数量 from(select op1.wgbm,op1.xm,op1.sfzh,op1.yhzgx, op1.zhbh, concat(op2.ldh,op2.dyh,op2.fh) as fwbh from member_info op1 left join house_info op2 on op1.wgbm = op2.wgbm  and op1.zhbh = concat(op2.ldh,op2.dyh,op2.fh)where op2.wgbm is not null ) a where  a.yhzgx = '户主' and a.wgbm = "+${G2}+"",1,1)

  • 3关注人数
  • 280浏览人数
  • 最后回答于:2022-6-8 11:33
    请选择关闭问题的原因
    确定 取消
    返回顶部