mysql 根据日期时间查询数据

转载自:www.cnblogs.com/sea-stream/p/11299667.html

mysql> select * from table1;
name_newtransactorpidorder_date
1hahha1xiaohong12019-08-04 20:45:47
2hahha2xiaohong22019-08-04 20:45:57
3hahha3xiaohong32019-08-04 20:46:02
4hahha4xiaohong42019-08-04 20:46:05
3hahhabob52019-08-04 20:46:08
3hahhalee62019-08-04 20:46:12

6 rows in set (0.01 sec)

mysql> select * from table1 where minute(order_date)=46;
name_newtransactorpidorder_date
3hahha3xiaohong32019-08-04 20:46:02
4hahha4xiaohong42019-08-04 20:46:05
3hahhabob52019-08-04 20:46:08
3hahhalee62019-08-04 20:46:12

4 rows in set (0.00 sec)

mysql> select * from table1 where second(order_date) between 2 and 12;
name_newtransactorpidorder_date
3hahha3xiaohong32019-08-04 20:46:02
4hahha4xiaohong42019-08-04 20:46:05
3hahhabob52019-08-04 20:46:08
3hahhalee62019-08-04 20:46:12

4 rows in set (0.00 sec)

mysql> select * from table1 where second(order_date) between 2 and 9;
name_newtransactorpidorder_date
3hahha3xiaohong32019-08-04 20:46:02
4hahha4xiaohong42019-08-04 20:46:05
3hahhabob52019-08-04 20:46:08

3 rows in set (0.00 sec)

评论

5 条

叼茂SEO.bfbikes.com

回复 ·

不错不错,我喜欢看 https://www.237fa.com/

回复 ·

看的我热血沸腾啊www.jiwenlaw.com

回复 ·

哈哈哈,写的太好了https://www.cscnn.com/

回复 ·

哈哈哈,写的太好了https://www.lawjida.com/

回复 ·

添加新评论