根据日期从表中选择数据 [英] selecting data from table based on date

查看:92
本文介绍了根据日期从表中选择数据的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有这样的数据库表

+-------+--------------+----------+
|   id  |    ip        |    date  |
+-------+--------------+----------+
|   505 |192.168.100.1 |2010-04-03|
|   252 |192.168.100.5 |2010-03-03|
|   426 |192.168.100.6 |2010-03-03|
|   201 |192.168.100.7 |2010-04-03|
|   211 |192.168.100.10|2010-04-03|
+-------+--------------+----------+

我该如何从该表中检索数据,其中month = 03如何编写sql来做到这一点.

how can i retirive data from this table where month=03 how to write sql to do that .

select * from table where month=03 

类似的东西.

推荐答案

如果使用mysql,请使用我认为的MONTH()函数.

If using mysql, use the MONTH() function I think.

select * from table where month(date) = 3

这篇关于根据日期从表中选择数据的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆