goods表如下:
name time product a 2016-1-2 13:23:00 wfey b 2016-2-17 11:43;34 asg a 2017-1-10 15:23:00 sgh c 2015-4-5 13:47:20 hrt c 2016-7-12 19:56:03 xcc a 2017-3-4 14:00:00 esfw
select distinct oo.name from (select name,date_format(time , '%h:%m') as ti from goods) as oo where ti between '12:00' and '14:00';
以上所述是www.887551.com给大家介绍的sqlserver查询某个时间段购买过商品的所有用户,希望对大家有所帮助