【问题标题】:sql query to get data greater than everyday at particular timesql查询在特定时间获取大于每天的数据
【发布时间】:2013-01-07 06:33:51
【问题描述】:

我想要所有存在于特定日期时间戳和表 create_datetime 列之外的记录。

运行此查询时,它应该提供大于 create_datetime 的当天的所有记录,具体时间为 18:00:00

【问题讨论】:

  • 您能否提供带有一些测试数据输入和预期输出的示例表定义?
  • select * from table where create_date_time > to_date('date_here'||18:00:00, 'dd-mon-yyyy hh24:mi:ss'; 其中date_here 是您的输入日期,格式为dd-mon-yyyy。这个问题很基础。

标签: sql oracle date-arithmetic sysdatetime


【解决方案1】:

您的问题文本有点切碎,但我认为您想要create_date 的时间元素在 18:00 之后的每条记录。如果是这样,这个查询将得到它。它使用日期格式掩码 SSSSS 返回日期为午夜后的秒数。

select * from your_table
where to_number(to_char(create_date, 'SSSSS')) >= (18 * (60*60))
and some_other_date >= trunc(sysdate)

该查询的另一部分是一个疯狂的猜测,因为就像我说的那样,您的问题在翻译中丢失了。我已经为“已将其他日期列设置为今天日期的记录”而大吃一惊。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2021-01-04
    • 1970-01-01
    • 1970-01-01
    • 2017-07-09
    • 2016-09-10
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多