全国统一服务热线:400-633-9193

SQLServer查询某个时间段购买过商品的所有用户

    网络     2017-07-31    1350

goods表如下:

?

1
2
3
4
5
6
7
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

?

1
2
3
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';


  分享到:  
0.2702s