怎么获取sqlserver某张表中日期列里的日期并排序 table1里有两列,日期列和ID 列,我根据传进来的参数2012查与日期列相同的日期只有年分,获取了2012-1-12 10:15:00,2012-2-12 10:15:00等许多,怎么把读到的数据的月份取出来并分组,如1,2,3,4,5,6急急急,在线等 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 select 日期,datepart(mm,日期) from table1 where datepart(year,日期) =2012group by datepart(mm,日期)order by datepart(mm,日期) 我现在想统计table2里面的金钱按照table1里的日期分组统计并显示到chart控件上,table1里的ID是主键table2里的ID是外键,怎么写代码啊,求详解 declare @riqi int=2012select convert(varchar(7),a.riqi,120),sum(b.[金额]) as total from table1 as a with(nolock) inner join table2 as b with(nolock) on a.id=b.idwhere datepart(a.riqi)=@riqigroup by convert(varchar(7),a.riqi,120)仅供参考 求一条SQL语句,求最近采购记录,谢谢 怎么将查询结果直接更新到表格? 存储过程分页问题 初学者的困惑,如果把整个开发过程串起来。 关于SQL SERVER的版本问题 结存问题! 使用查询分析器创建用户自定义数据类型 sql2005登录的问题 存储过程-复合if else? 为什么程序中编有存储过程的时候,就提示Invalid handle SQL语句,高分在线等待.... 求sql语句
where datepart(year,日期) =2012
group by datepart(mm,日期)
order by datepart(mm,日期)
declare @riqi int=2012
select convert(varchar(7),a.riqi,120),sum(b.[金额]) as total from table1 as a with(nolock)
inner join table2 as b with(nolock) on a.id=b.id
where datepart(a.riqi)=@riqi
group by convert(varchar(7),a.riqi,120)仅供参考