SQLServer查询某个时间段购买过商品的所有用户
时间:2021-03-13 09:49:09|栏目:MsSql|点击: 次
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';