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

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

WBOY
WBOYOriginal
2016-06-07 14:53:391721browse

统计主表关联的满足一定条件的子表数量 统计主表关联的子表数量: 其中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  

+ 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

+ znId 

+ "')) as shuliang from dual";
 

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn