日期:2014-05-17  浏览次数:20710 次

查询语句?
这样的需求..

查询A表的记录,,要求,查询出等于当前月份的记录,但不等于下个月份的记录

结构:

id rddate name
1 2012-06 p
2 2012-06 d
3 2012-07 l

只查出以上三条记录的前两条..怎么写sql,,谢谢..

------解决方案--------------------
select * from A where month(rddate)=month(getDate()) 
试试这个

------解决方案--------------------
如果分年份的话,还要加年
... and year(rddate)=year(getDate()) 



------解决方案--------------------
探讨

如果分年份的话,还要加年
... and year(rddate)=year(getDate())