mardi 6 octobre 2015

Find date beetween dates

I want to insert dates in my (SQLLite) database (format: yyyyMMdd). This dates shoudln't overlap the same time.

I tried to use this:

SELECT COUNT(*) FROM termine WHERE string = "" AND ((startDay BETWEEN 20151007 AND 20151009) OR (endDay BETWEEN 20151007 AND 20151009))

Problem: If the database contains values like startDay = 20151006 and endDay = 20151010, my method won't work, because the dates are not beetween the others.

So, what is the easiest way to check if a date is in the range of another?

Aucun commentaire:

Enregistrer un commentaire