goods表如下: name time productA 2016-1-2 13:23:00 WFEYB 2016-2-17 11:43;34 ASGA 2017-1-10 15:23:00 SGHC 2015-4-5 13:47:20 HRTC 2016-7-12 19:56:03 XCCA 2017-3-4 14:00:00 ESFW SELECT DISTINCT OO.name FROM (SELECT name,DATE_FORMAT(time ,
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';
以上所述是小编给大家介绍的SQLServer查询某个时间段购买过商品的所有用户,希望对大家有所帮助,如果大家有任何疑问请给我留言,小编会及时回复大家的。在此也非常感谢大家对每日运维网站的支持!