关于数据库查询的小问题!

heatwin 2003-05-25 10:45:37
表Sale中有Amount,DateUpdated字段为:金额,和日期(yy-mm-dd)

现我想实现这样的查询,得到每个月的金额总额,请问如何使用查询语句?
...全文
17 4 打赏 收藏 转发到动态 举报
写回复
用AI写文章
4 条回复
切换为时间正序
请发表友善的回复…
发表回复
syszj 2003-05-25
  • 打赏
  • 举报
回复
select sum(Amount) as 金額,year(DateUpdated) as 年,month(DateUpdated) as 月 from sale group by year(DateUpdated),month(DateUpdated)
chenyu5188 2003-05-25
  • 打赏
  • 举报
回复
完全同意楼上两位的方法

forever_chang 2003-05-25
  • 打赏
  • 举报
回复
select sum(Amount)as 总金额 from sale where YEAR(DateUpdated)=2003 and MONTH(DateUpdated)=3
wyqwn 2003-05-25
  • 打赏
  • 举报
回复
select sum(Amount)as 总金额 from sale where DateUpdated=#03-03#
03-03是2003年03月
或者可以 select sum(Amount)as 总金额 from sale
where DateUpdated between #03-03-05# and #03-03-15#

查询2003年3月5号到3月15号 的记录

1,216

社区成员

发帖
与我相关
我的任务
社区描述
VB 数据库(包含打印,安装,报表)
社区管理员
  • 数据库(包含打印,安装,报表)社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧