Python Forum

Full Version: Find overlapping date in database
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
I have entered the start and end date and now I want to find the number of days which overlap with the start and end date in my database. I am having difficulty finding a logic in python which will do this job. I am using Oracle database.
I think (Can't test) SELECT * FROM tablename WHERE TO_DATE('01/01/2021', 'MM/DD/YYYY') <= TO_DATE('12/16/2021', 'MM/DD/YYYY')
will do it, replace tablename with your tablename, and change dates to your requirement.
(Dec-16-2021, 04:39 PM)Larz60+ Wrote: [ -> ]I think (Can't test) SELECT * FROM tablename WHERE TO_DATE('01/01/2021', 'MM/DD/YYYY') <= TO_DATE('12/16/2021', 'MM/DD/YYYY')
will do it, replace tablename with your tablename, and change dates to your requirement.

Thanks a lot for your help, it worked.