永发信息网

日期格式2009/12/08 我想用SQL取年月,不要日期

答案:3  悬赏:50  手机版
解决时间 2021-05-06 14:50
  • 提问者网友:却不属于对方
  • 2021-05-05 18:44
Select comFundAffirmSub.ProdID,Sum(SQuantity) as 销退货数量合计,Sum(Amount) as 无税金额合计 FROM comFundAffirmSub WHERe comFundAffirmSub.Flag=506 Group by comFundAffirmSub.ProdID Order by comFundAffirmSub.ProdID
这个语句我要加上日期,但是只取年月
最佳答案
  • 五星知识达人网友:等灯
  • 2021-05-05 19:29
Select comFundAffirmSub.ProdID,Sum(SQuantity) as '销退货数量合计',Sum(Amount) as '无税金额合计',(datepart(year,getdate())*100+datepart(month,getdate()))
as '日期' FROM comFundAffirmSub WHERe comFundAffirmSub.Flag=506 Group by comFundAffirmSub.ProdID Order by comFundAffirmSub.ProdID
全部回答
  • 1楼网友:杯酒困英雄
  • 2021-05-05 20:41
Select comFundAffirmSub.ProdID,Sum(SQuantity) as 销退货数量合计,Sum(Amount) as 无税金额合计,convert(varchar(7),getdate(),120) as '日期' FROM comFundAffirmSub WHERe comFundAffirmSub.Flag=506 Group by comFundAffirmSub.ProdID Order by comFundAffirmSub.ProdID
  • 2楼网友:痴妹与他
  • 2021-05-05 20:10

要是字符串就直接用SUBSTRING啦。。呵呵

我要举报
如以上回答内容为低俗、色情、不良、暴力、侵权、涉及违法等信息,可以点下面链接进行举报!
点此我要举报以上问答信息
大家都在看
推荐资讯