日期:2014-05-18 浏览次数:20510 次
SELECT ZYH, HCRQ, ZZRQ FROM ZY_HCMX t WHERE (HCLX = 0) AND (HQCH IS NULL) AND (HCRQ >= '2012-1-1') AND (HCRQ < '2012-2-1') and not exists (select 1 from ZY_HCMX WHERE (HCLX = 0) AND (HQCH IS NULL) AND (HCRQ >= '2012-1-1') AND (HCRQ < '2012-2-1') and ZYH=t.ZYH and HCRQ<t.HCRQ) ORDER BY ZYH
------解决方案--------------------
SELECT ZYH, (select min(HCRQ)from ZY_HCMX WHERE ZYH=z.ZYH )HCRQ, ZZRQ FROM ZY_HCMX z WHERE (HCLX = 0) AND (HQCH IS NULL) AND (HCRQ >= '2012-1-1') AND (HCRQ < '2012-2-1') ORDER BY ZYH
------解决方案--------------------
顶一下吧,坐等楼下解释