I have following data
Sr. FromDate ToDate Code
1 1990-01-01 2000-08-31 A
2 2000-09-01 2001-05-31 B
3 2001-06-01 2018-12-31 C
and need to write SQL query to find rows having code for date range= fromdate 1992-01-01 and ToDate 2000-12-31.
Select *
From Table
Where fromDate <= 1992-01-01
and EndDate >=2000-12-31
not returning proper data.
Any help??
Expected output are first two rows which cover part of date mentioned in query.
One of possible query is:
Select * From table where fromdate <= 19920101 UNION Select * From table where todate >= 20011231
But some how I don't like it and wanted easier alternative.