I am trying to fetch data from 2 different tables which contains 2 date columns(ENCODINGDATETIME AND CREATEDON). Now, I need those records where days gap between Encoding datetime column and CREATEDON column are more than 7 days.
I created below SQL to get the required data but I think it isn’t giving me correct data. Can anyone please suggest me what condition needs to be added in this query to get required data.
Query : Select * from (SELECT P.DHLPARCELID,trunc(P.ENCODINGDATETIME)-trunc(PB.CREATEDON) as number_of_days FROM PARCEL P, PARCELBILLING PB WHERE P.ID=PB.PARCEL.ID) where number_of_days > 7