on 01-15-2022 4:30 PM
Hi Experts,
I have a requirement where i want to display YTD in webi where the DB is Oracle and i want this in sql query of the report.
Currently its using syntax:
For YTD:- select TRUNC (sysdate, 'year')-1 /* its giving date as 31 Dec 2021 in DB when ran on 13th Jan 2022 , while it must return 1/1/2021 as per requirement */
whereas
For MTD:- select TRUNC (sysdate, 'mon')-1 /* is giving 31 Dec 2021 in DB which is correct for MTD */
Please help me in getting this YTD issue solved.
Database is Oracle.
Thanks
Vaibhav
Please test add_months(sysdate, -1), which should help.
fyi,
https://docs.oracle.com/cd/B19306_01/server.102/b14200/functions004.htm
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
83 | |
10 | |
10 | |
9 | |
7 | |
6 | |
5 | |
5 | |
4 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.