• oracle日期合并 分别用逗号或者分号隔开



    逗号隔开','
    select
    LISTAGG(SUBSTR(TO_CHAR(FREESTARTTIME,'YYYY-MM-DD HH24:MI:SS'),11,9) ||'~'||trim(SUBSTR(TO_CHAR(FREEENDTIME,'YYYY-MM-DD HH24:MI:SS'),11,9)),',')WITHIN GROUP (ORDER BY TPF.FREEID) AS FREETIMESPAN FROM TRA_PRICINGBERTH TPB LEFT JOIN TRA_PRICINGFREE TPF ON TPB.PRICINGSTRATEGYID = TPF.PRICINGSTRATEGYID WHERE TPB.BERTHCODE='108211' AND TPF.FREEDATETYPE='1' SELECT LISTAGG( (SBPT.PARKSTIME||'~'||SBPT.PARKETIME),',') WITHIN GROUP (ORDER BY SBPT.PARKTIMEID) AS SAREE FROM SYS_BERTHANDTYPE SBT LEFT JOIN SYS_BERTHTYPEPARKTIME SBPT ON SBT.BERTHTYPEID = SBPT.BERTHTYPEID WHERE SBT.BERTHCODE='108211' AND SBPT.DATETYPE = 1 AND SBPT.ISALLOW =2 AS NOTALLOWTIMESPAN

    20:00:00~23:59:59, 00:00:00~07:29:00

    分号隔开';' 用trim实现去空格功能
    select
    LISTAGG(SUBSTR(TO_CHAR(FREESTARTTIME,'YYYY-MM-DD HH24:MI:SS'),11,9) ||'~'||trim(SUBSTR(TO_CHAR(FREEENDTIME,'YYYY-MM-DD HH24:MI:SS'),11,9)),';')WITHIN GROUP (ORDER BY TPF.FREEID) AS FREETIMESPAN FROM TRA_PRICINGBERTH TPB LEFT JOIN TRA_PRICINGFREE TPF ON TPB.PRICINGSTRATEGYID = TPF.PRICINGSTRATEGYID WHERE TPB.BERTHCODE='108211' AND TPF.FREEDATETYPE='1' SELECT LISTAGG( (SBPT.PARKSTIME||'~'||SBPT.PARKETIME),';') WITHIN GROUP (ORDER BY SBPT.PARKTIMEID) AS SAREE FROM SYS_BERTHANDTYPE SBT LEFT JOIN SYS_BERTHTYPEPARKTIME SBPT ON SBT.BERTHTYPEID = SBPT.BERTHTYPEID WHERE SBT.BERTHCODE='108211' AND SBPT.DATETYPE = 1 AND SBPT.ISALLOW =2 AS NOTALLOWTIMESPAN

    20:00:00~23:59:59;00:00:00~07:29:00
  • 相关阅读:
    洛谷 P2008 大朋友的数字
    [USACO10FEB]慢下来Slowing down
    HAOI2007 理想的正方形 单调队列
    滑动窗口
    双栈排序
    概率无向图模型与条件随机场的异同
    P-R曲线出现凹陷的原因
    MaskLab-实例分割(使用语义分割和方向特征精细化目标检测)
    模拟递归生成器
    递归生成器
  • 原文地址:https://www.cnblogs.com/Warmsunshine/p/4573395.html
Copyright © 2020-2023  润新知