Hi ,
I have the below query where am using TRUNC on the column2 filed which is increasing the performance delay.
so need to avoid the TRUNC on this check and need to use BETWEEN operator.
Here SYSTEMDATE is the currentdateandtime.
So how can write a between condition so that column2[which included time part as well] is between the time of the systemdate[which included time part as well].
Current query:
SELECT sum(column3)
from table1
where column1 = ‘XXXXXAA12’
and TRUNC(column2) = TRUNC(SYSTEMDATE)
Need to have smthng below:
SELECT sum(column3)
from table1
where column1 = ‘XXXXXAA12’
and column2 between xxxxxxxxxxxxxxxxx and xxxxxxx
so without using TRUNC on both sides how to write the query ?
Please suggest ??
Thank you in advance.
Use TO_DATE Function.
SELECT sum(column3)
from table1
where column1 = ‘XXXXXAA12’
and column2 between to_date (<yor val>,<your format>) and to_date (<yor val>,<your format>);