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 コマンドの意味がわかりませんでした:
ここで、to_date('2013-03-01', 'yyyy-mm-dd') と trunc(sysdate, 'mm') -1の間の日付
「-1」は何を意味しますか?
他の例は
trunc(months_between(date1, date2)) +1
私はこれを検索しましたが、ものを見つけることができませんでした。
アドバイスありがとうございます!
+1日付に日を追加する方法です
+1
-1日付までの日を削除する方法です
-1
あなたの特定のケースでは:
この命令trunc(sysdate, 'mm') -1は、日付までの 1 か月を削除します。この場合は、現在の日付の 1 か月前です。
trunc(sysdate, 'mm') -1
この命令trunc(months_between(date1, date2))+1は、2 つの日付の月の差を計算し、1 を加算します。
trunc(months_between(date1, date2))+1
このSQLFiddleを見てください
日を加算または減算する怠惰な方法です