统计主表关联的满足一定条件的子表数量

原创
2016-06-07 14:53:39 1381浏览

统计主表关联的满足一定条件的子表数量 统计主表关联的子表数量: 其中znld是主表的id; 主表:specialcase 子表:to_zhuanan_xsczqk,to_zhuanan_xckcqz www.2cto.com String cxfSql = select ((select count(*) from to_zhuanan_xsczqk a,specialcase b wh


统计主表关联的满足一定条件的子表数量

统计主表关联的子表数量:

其中znld是主表的id;

主表:specialcase

子表:to_zhuanan_xsczqk,to_zhuanan_xckcqz

www.2cto.com

String cxfSql = "select ((select count(*) from to_zhuanan_xsczqk a,specialcase b where a.zhuanan_id=b.id and a.xsczqksj>=to_date('"+ time1+ "','yyyy-MM-dd') and a.xsczqksj<=to_date('"+ time2+ "','yyyy-MM-dd') and b.id= '"

+ znId

+ "')+(select count(*) from to_zhuanan_xckcqz a,specialcase b where a.zhuanan_id=b.id and a.XCKCQZSJ>=to_date('"+ time1+ "','yyyy-MM-dd') and a.XCKCQZSJ<=to_date('"+ time2+ "','yyyy-MM-dd') and b.id= '"

+ znId

+ "')) as shuliang from dual";

声明:本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系admin@php.cn核实处理。