瀚高数据库的时间比较

2023-07-17 19:58:31 浏览数 (2)

代码语言:javascript复制
 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')

代码语言:javascript复制
    and  to_char (to_Date(#{endTime},'yyyy-MM-dd  HH24:mi:ss'),'yyyy-MM-dd')
        )

0 人点赞