Skip to Main Content

SQL & PL/SQL

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Date Condition - Up to current date minus one month

PhaedrusMar 1 2017 — edited Mar 1 2017

Hello,

I'm trying to create a query that will show me customers with late contracts.

I want to include all contracts up to the current date minus one month.

I've searched the forums and come up with a few options none of which are giving me the results I need.

WHERE al.DELVPERIOD_FROM <= (trunc(sysdate, 'MM')-1) and also

WHERE al.DELVPERIOD_FROM < (trunc(sysdate, 'MM'))

These appeared to work at first but I late found that many contracts I would expect to find are missing. I'm not sure why this is. For example, a customer's late contracts from 10/1/16 are not included but the same customer will have late contracts from 2/1/17 included. Other customers will have late contracts from 10/1/16 included however.

Any help is very appreciated.

Thank you

This post has been answered by Chris Hunt on Mar 1 2017
Jump to Answer
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Mar 29 2017
Added on Mar 1 2017
9 comments
710 views