I have two time fields (startdate and enddate) in Table A to record the start and end dates of the contract. Now I also enter the start time and end time on the page for query. come out?
solved
declare @b datetime
set @b = '2017-01-01'
declare @e datetime
set @e = '2017-12-01'
Select * from table where (@b between StateDate and EndDate or @e between StateDate and EndDate)
Oh it should be so comprehensive
declare @b datetime
set @b = '2017-01-01'
declare @e datetime
set @e = '2017-12-01'
Select * from table
@b between StartDate and EndDate or @e between StartDate and EndDate or startdate> = @ b and enddate <= @ e