Query date and specific time in the where clause 3

雨燕双飞 提交于 2019-12-13 03:46:22

问题


How can I get 3rd shift data from the where clause. I'm using current date, but even with what I don't get any resutls. I'm looking to see 3rd shift sale from time range 9pm to 5am ( Next Day ).

SELECT WORK_CENTER, SUM(SALES) AS SALES 
FROM ZME_SALES
WHERE DATE_TIME_START >=sys_extract_utc(cast(trunc(current_date) + 21/24 as time stamp with time zone))
AND DATE_TIME_START <  sys_extract_utc(cast(trunc(current_date)+1 + 5/24 as timestamp with time zone)) 

Here's my expected results.

SHIFT      WORK_CENTER   SALES
SHIFT-3    8001          1524
SHIFT-3    8002          1347
SHIFT-3    8003          1201
SHIFT-3    8004          1146

来源:https://stackoverflow.com/questions/53603707/query-date-and-specific-time-in-the-where-clause-3

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!