sql日期查询问题 我的表中的日期字段是datetime类型的现在我想查询某月的所有信息 请问sql语句该怎么写啊 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 SELECT * FROM TBWHERE YEAR(DATE)=2010 AND MONTH(DATE)=6 datenamedatepartorconvert(varchar(7),字段,120) select * from tb where convert(varchar(10),s_date,120)='2010-06-20' select *from tbwhere convert(varchar(7),col,120)='2010-05'--orselect *from tbwhere year(col)=2010 and month=5 select * from T where convert(,char(7),日期字段,120) ='yyyy-mm''yyyy-mm' 为参数 select * from ta where year(col)='' and month='' select * from T where convert(char(7),日期字段,120) ='yyyy-mm' select * from tb where convert(varchar(4),dt,120)=你要查的年数 and month(dt)=5 select * from tb where convert(varchar(4),dt,120)=你要查的年数 and month(dt)=6 select * from tb where year(col)=2010 and month=5 比较两个时间的月份差异想同的数据就是你想要的select * from tabel1 where datediff(month,date1,@date2) = 0 求教:UPDATE 急 关于修改一个字段里的内容? mdx新手问题—层次结构在crossjoin函数中调用多次 有没有通用的表复制储存过程啊 一个表左连接另一个表十多次?有没有好的方法,让速度更快? 关于delphi中使用事务引发后台触发器的疑问? 在Sql Server中如何进行大小写敏感的字符串比较? 请问各位一个数据类型转换的问题 MSSQL 数据库 备份问题 (上传至网上) 生成(表)脚本,完不成的任务? C#怎样读取远程数据库的数据,急用,在线等 CSDN无人了??????
WHERE YEAR(DATE)=2010 AND MONTH(DATE)=6
datepartorconvert(varchar(7),字段,120)
from tb
where convert(varchar(7),col,120)='2010-05'
--or
select *
from tb
where year(col)=2010 and month=5
select * from ta where year(col)='' and month=''
select * from T where convert(char(7),日期字段,120) ='yyyy-mm'
select * from tb where convert(varchar(4),dt,120)=你要查的年数 and month(dt)=5
select * from tabel1 where datediff(month,date1,@date2) = 0