我想过滤时间 我有记录 我写过这样的查询 查询将在 12:00 Pm 和 05:00 Pm 之间获取时间
Select cs_ClinicName , FromTime ,ToTime from #temp
WHERE (1=1) and
( FromTime between CONVERT(Time,'12:00') and CONVERT(Time,'17:00')
or
ToTime between CONVERT(Time,'12:00') and CONVERT(Time,'17:00') )
但它只过滤这条记录 Micolaj11111 09:00:00.0000000 13:00:00.0000000
我期望的是,根据记录,所有在下午 12:00 到下午 5:00 之间工作的诊所都必须在那个时间段 12:00 到 05:00 之间工作)
Clinic NAME FromTime ToTime
Boyka 09:00:00.0000000 18:00:00.0000000
Clinic Name 10:00:00.0000000 18:00:00.0000000
sleek clini 10:00:00.0000000 18:00:00.0000000
Life Clinic 10:00:00.0000000 18:00:00.0000000
SAiClini 09:00:00.0000000 18:00:00.0000000
jh 10:00:00.0000000 19:00:00.0000000
Micolaj11111 09:00:00.0000000 13:00:00.0000000
Dental Clinic 10:00:00.0000000 19:00:00.0000000
Eye clinic 09:00:00.0000000 18:00:00.0000000
ryan 01:00:00.0000000 06:00:00.0000000