在SQL语句中怎样查询出当年当月的数据?我用的是SQL server数据库,表ordered 中有一日期字段srrq,我想统计当年当月的数据,SELECT 语句该怎样写
sql="Select xh,sum(sl) from rkd where year(jhrq)="&year(date())&" and month(jhrq)="&month(date()&" group by xh "为何不行,请高手指教!
...全文
9065打赏收藏
在SQL语句中怎样查询出当年当月的数据?
在SQL语句中怎样查询出当年当月的数据?我用的是SQL server数据库,表ordered 中有一日期字段srrq,我想统计当年当月的数据,SELECT 语句该怎样写 sql="Select xh,sum(sl) from rkd where year(jhrq)="&year(date())&" and month(jhrq)="&month(date()&" group by xh "为何不行,请高手指教!