IF Time({PCTIme.ShutT}) >= time(00,00,00) and Time({PCTIme.ShutT}) < time(06,00,00) then
"12AM - 6AM"
else IF Time({PCTIme.ShutT}) >= time(06,00,00) and Time({PCTIme.ShutT}) < time(12,00,00) then
"6AM -12PM"
else IF Time({PCTIme.ShutT}) >= time(12,00,00) and Time({PCTIme.ShutT}) < time(18,00,00) then
"12PM - 6PM"
else IF Time({PCTIme.ShutT}) >= time(18,00,00) and Time({PCTIme.ShutT}) < time(23,59,59) then
"6PM - 12AM"
答案 0 :(得分:0)
使用START_HOUR列和4行创建一个名为TIME_SLOT的表:
00am
06am
下午12点
下午18点
使用以下逻辑将表与DOWN_TIME表联接:
TIME_SLOT.Start_Hour >= @DOWN_TIME_Start_Hour AND
TIME_Slot.Start_Hour < @DOWN_TIME_End_Hour
这将导致每个DOWN_TIME记录加入与跨度相应的多个时隙。