瀚高数据库的时间比较
warning:
这篇文章距离上次修改已过577天,其中的内容可能已经有所变动。
SELECT
COUNT (1)
FROM
(
select
(
CASE
WHEN b.type = 0 then '自住户' WHEN b.type = 1 then '租户' WHEN b.type = 4 then '常客' else '其他'
end
) "type"
from
zhsq_housing_information b
left join zhsq_user_info a on
b.user_id = a.id
where to_char (to_Date(b.create_time,'yyyy-MM-dd HH24:mi:ss'),'yyyy-MM-dd') between to_char (to_Date(#{startTime},'yyyy-MM-dd HH24:mi:ss'),'yyyy-MM-dd')
and to_char (to_Date(#{endTime},'yyyy-MM-dd HH24:mi:ss'),'yyyy-MM-dd')
)
to_char (to_Date(b.create_time,'yyyy-MM-dd HH24:mi:ss'),'yyyy-MM-dd') between to_char (to_Date(#{startTime},'yyyy-MM-dd HH24:mi:ss'),'yyyy-MM-dd')
and to_char (to_Date(#{endTime},'yyyy-MM-dd HH24:mi:ss'),'yyyy-MM-dd')
)