首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 数据库 > 其他数据库 >

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

2012-10-31 
统计主表关联的满足一定条件的子表数量统计主表关联的子表数量:其中znld是主表的id;主表:specialcase 子表

统计主表关联的满足一定条件的子表数量
统计主表关联的子表数量:
其中znld是主表的id;
主表:specialcase
子表:to_zhuanan_xsczqk,to_zhuanan_xckcqz

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";

热点排行