select icupatient0_.INTO_ICU_NURSING_LEVEL as col_0_0_,icupatient0_.icu_region_id
from ICU_PATIENT icupatient0_
where
(to_date(to_char(icupatient0_.INTO_ICU_TIME, 'yyyy-mm-dd hh24:mi:ss'), 'yyyy-mm-dd hh24:mi:ss') <=
to_date('2014-05-01 00:00', 'yyyy-mm-dd hh24:mi:ss')
and to_date(to_char(icupatient0_.OUT_ICU_TIME, 'yyyy-mm-dd hh24:mi:ss'), 'yyyy-mm-dd hh24:mi:ss') >=
to_date('2014-05-01 00:00', 'yyyy-mm-dd hh24:mi:ss')
) or (to_date(to_char(icupatient0_.INTO_ICU_TIME, 'yyyy-mm-dd hh24:mi:ss'), 'yyyy-mm-dd hh24:mi:ss') >=
to_date('2014-05-01 00:00', 'yyyy-mm-dd hh24:mi:ss')
and to_date(to_char(icupatient0_.INTO_ICU_TIME, 'yyyy-mm-dd hh24:mi:ss'), 'yyyy-mm-dd hh24:mi:ss') <=
to_date('2014-05-27 23:59:59', 'yyyy-mm-dd hh24:mi:ss'))
and icupatient0_.ICU_REGION_ID = 2
group by icupatient0_.INTO_ICU_NURSING_LEVEL;
结果:
region_id 放到where后面:
select icupatient0_.INTO_ICU_NURSING_LEVEL as col_0_0_,icupatient0_.icu_region_id
from ICU_PATIENT icupatient0_
where icupatient0_.ICU_REGION_ID = 2 and
(to_date(to_char(icupatient0_.INTO_ICU_TIME, 'yyyy-mm-dd hh24:mi:ss'), 'yyyy-mm-dd hh24:mi:ss') <=
to_date('2014-05-01 00:00', 'yyyy-mm-dd hh24:mi:ss')
and to_date(to_char(icupatient0_.OUT_ICU_TIME, 'yyyy-mm-dd hh24:mi:ss'), 'yyyy-mm-dd hh24:mi:ss') >=
to_date('2014-05-01 00:00', 'yyyy-mm-dd hh24:mi:ss')
) or (to_date(to_char(icupatient0_.INTO_ICU_TIME, 'yyyy-mm-dd hh24:mi:ss'), 'yyyy-mm-dd hh24:mi:ss') >=
to_date('2014-05-01 00:00', 'yyyy-mm-dd hh24:mi:ss')
and to_date(to_char(icupatient0_.INTO_ICU_TIME, 'yyyy-mm-dd hh24:mi:ss'), 'yyyy-mm-dd hh24:mi:ss') <=
to_date('2014-05-27 23:59:59', 'yyyy-mm-dd hh24:mi:ss'))
group by icupatient0_.INTO_ICU_NURSING_LEVEL;
结果:icu_region_ID参数只关联or前面查询,结果出错