I have a time field called Epoch that I know how to pull data from 6 to 8 AM out of. I do not know how to do that for 6:30 to 8:30, since datepart is hour or minute not both. Here is the code I have thus far.
select tmc_code, avg(speed) as AVGS
from [dbo].[CEAR_FULL_NONULL_CARS_3_12]
where epoch between (datepart(hour, epoch) = 6 and datepart(minute, epoch) = 30) and (datepart(hour, epoch) = 8 and datepart(minute, epoch) = 25)
group by TMC_Code order by tmc_code