比如我要查一张表里ActiveDate为2009年12月的所有数据除了select * from 表1 where ActiveDate between '2009-12-1' and '2009-12-31';
select * from 表1 where ActiveDate >='2009-12-1' and <='2009-12-31';
select * from 表1 where year(ActiveDate)='2009' and month(ActiveDate)='12'之外
还有没有其它用函数可以解决的方法?
select * from 表1 where ActiveDate >='2009-12-1' and <='2009-12-31';
select * from 表1 where year(ActiveDate)='2009' and month(ActiveDate)='12'之外
还有没有其它用函数可以解决的方法?
from tb1
where convert(char(7),activedate,120) = '2009-12'
*
from
tb
where
convert(varchar(10),ActiveDate,7)='2009-12'
select * from 表1 where ActiveDate >='2009-12-1' and <='2009-12-31'; 这两句就挺好的,可以用到SARG,比函数好