当前位置: 代码迷 >> ASP >> 查询语句?解决方案
  详细解决方案

查询语句?解决方案

热度:331   发布时间:2012-09-22 21:54:54.0
查询语句?
这样的需求..

查询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())
  相关解决方案