【问题标题】:concat yesterdays date with a specific time将昨天的日期与特定时间连接起来
【发布时间】:2013-12-31 23:04:25
【问题描述】:

我需要创建一个查看昨天日期但在特定时间的查询。我希望时间部分采用“hh24:mi:ss”格式,因为这是搜索字段的格式。

当我运行这个查询时,它可以工作:

where date_dt = to_date('2013-12-13' || '19:16:08','yyyy-mm-dd hh24:mi:ss')

但是当我尝试查询昨天时却没有:

where date_dt = to_date(trunc(sysdate)-1 || '19:16:08','yyyy-mm-dd hh24:mi:ss')

我得到零行返回。知道我在这里做错了什么吗?

谢谢。

【问题讨论】:

    标签: oracle timestamp


    【解决方案1】:
    where date_dt = to_date(to_char(sysdate-1, 'YYYY-MM-DD') || ' 19:16:08', 'YYYY-MM-DD HH24:MI:SS')
    

    应该可以。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多