Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
是否可以在 SQL 中放置相对/静态日期和时间?
我想得到昨天和前天的结果。
所以让我们说(current_date-2 06:00:00)和(current_date-1 06:00:00)之间的日期。从 24 小时范围内获取结果,但具有特定时间。由于我将它用于 BI 工具,因此只能接受普通 SQL。
您可以使用
between trunc(sysdate) - 2 + 6/24 and trunc(sysdate) - 1 + 6/24
6/24 意味着六个小时,因为在 Oracle 1 中是一天。