[Solved] SQL – Select all row that exist between two dates [closed]


I think this should work.
I used :start and :end as placeholders for your input values.

The query selects all employees with their working dates when the working date is at least partially part of your input range.

Visualization (I: input range, y: selected, n: not selected):

--------IIIIIIIIIIIIIIIIIIII----------
--nnn-yyyy---yyyy---------yyyyy----nn-

Query:

SELECT * 
FROM workdates
WHERE     
    work_from < :end AND
    until > :start

2

solved SQL – Select all row that exist between two dates [closed]