sql---两个查询
1.
SELECT D.WGMC, D.JDMC, D.HS, COUNT(6) ZSFROM(SELECT C.WGMC WGMC,C.WGBM WGBM,C.JDMC JDMC,C.HS HSFROM (SELECT COUNT(2) HS,WG.WGMC,WG.WGBM,JD.JDMC FROM T_SHSJGL_GH H, T_SHSJGL_WG WG,T_SHSJGL_SQ SQ,T_SHSJGL_JD JD WHERE H.GRID_ID = WG.ID AND WG.SQID = SQ.ID AND SQ.JDID = JD.ID GROUP BY WG.WGMC,WG.WGBM,JD.JDMC ) C WHERE C.HS<70) D,T_SHSJGL_GZ GZWHERE GZ.SZWG=D.WGBMGROUP BY D.WGMC, D.JDMC, D.HSORDER BY D.HS ASC
SELECT C.WGMC WGMC,C.JDMC JDMC,C.HS HS,COUNT(C.ZBM) ZSFROM (SELECT COUNT(2) HS,WG.WGMC WGMC,GZ.ZBM ZBM,JD.JDMC JDMCFROM T_SHSJGL_GH H, T_SHSJGL_GZ GZ,T_SHSJGL_WG WG,T_SHSJGL_SQ SQ,T_SHSJGL_JD JDWHERE H.GRID_ID = WG.ID AND GZ.SZWG=WG.WGBM AND WG.SQID = SQ.ID AND SQ.JDID = JD.ID GROUP BY WG.WGMC,GZ.ZBM,JD.JDMC ) C WHERE C.HS<70GROUP BY C.WGMC,C.JDMC,C.HSORDER BY C.HS ASC