表A
id name time
1 '都是' 2010-03-22 00:42:47.293
2 '都是' 2010-04-22 00:43:33.187
3 '都是' 2010-04-23 00:43:37.280
4 '都是' 2010-05-22 00:43:39.450
5 '都是' 2010-06-22 00:43:40.543
6 '都是' 2010-07-22 00:43:41.560
7 '都是' 2011-04-22 00:43:47.107
8 '都是' 2012-04-22 00:43:50.293
9 '都是' 2013-04-22 00:43:59.950
10'都是' 2010-04-23 00:44:05.310
11'都是' 2010-04-22 00:44:07.170
12'都是' 2010-05-22 00:44:08.623怎么根据日期查询啊 查询2010年的所有Name
查询2010年3月所有数据
查询2010年3月22日的所有数据谢谢
id name time
1 '都是' 2010-03-22 00:42:47.293
2 '都是' 2010-04-22 00:43:33.187
3 '都是' 2010-04-23 00:43:37.280
4 '都是' 2010-05-22 00:43:39.450
5 '都是' 2010-06-22 00:43:40.543
6 '都是' 2010-07-22 00:43:41.560
7 '都是' 2011-04-22 00:43:47.107
8 '都是' 2012-04-22 00:43:50.293
9 '都是' 2013-04-22 00:43:59.950
10'都是' 2010-04-23 00:44:05.310
11'都是' 2010-04-22 00:44:07.170
12'都是' 2010-05-22 00:44:08.623怎么根据日期查询啊 查询2010年的所有Name
查询2010年3月所有数据
查询2010年3月22日的所有数据谢谢
解决方案 »
- 反射加载程序集中的诡秘事件,求高手指教一二!
- flex 动态加载imageMap
- 怎么实现SQL语句里的字段去让它等于文本框的值?
- 请教大师,获取cookie的问题
- flash存储问题
- 公司的网站上传到服务器出现了Server Error in '/' Application.
- 我使用ActiveReports for .NET进行打印,我想让它横向打印,在打印对话框的布局里也进行了设置,可它总是纵向打印,这是为什么?
- 请问在asp.net编程时为什么在宣告命名空间?谢谢~
- asp.net做服务器,外网如何访问呀?
- 焦点问题??
- distinct查询多列,过滤一个重复字段
- 求高手帮忙看下怎么取得虚拟路径!!谢谢了
datepart
2 select * from tb where time>=cast('2010-3' as datetime) and time<cast('2010-4' as datetime)
3 select * from tb where time>=cast('2010-3-22' as datetime) and time<cast('2010-3-23' as datetime)
select * from tb where year(time)=2010--查询2010年3月所有数据
select * from tb where year(time)=2010 and month(time)=3
--查询2010年3月22日的所有数据
select * from tb where year(time)=2010 and month(time)=3 and day(time)=22
select name from 表A where year(time)=2010select * from 表A where month(time)=3 select * from 表A where time='2010-3-22'
select * from tb where year(time)=2010--查询2010年3月所有数据
select * from tb where year(time)=2010 and month(time)=3
--查询2010年3月22日的所有数据
select * from tb where convert(CHAR(10),TIME,20)='2010-03-22'
select * from tb where datediff(mm,'2010-3-1',time)=0
select * from tb where datediff(d,'21010-3-22'time)=0