失眠网,内容丰富有趣,生活中的好帮手!
失眠网 > access 数据库写按日期查询SQL

access 数据库写按日期查询SQL

时间:2020-12-17 06:26:55

相关推荐

access 数据库写按日期查询SQL

按具体某一年查询数据

select sum(amount) from 表名 where format(createtime,"yyyy")=

按具体某一年某个月查询

select sum(amount) from 表名 where format(createtime,"yyyymm")=01

按月统计某一年的数据

select sum(amount) as total,Month(createtime) as month from (select * from t_records where format(createtime,"yyyy")=) group by Month(createtime)

同理,按年统计一段时间内的数据

select sum(a.amount) as total,Year(a.createtime) as year from (select * from t_records where createtime between #-1-1 00:00:00# and #-12-31 23:59:59#) as a group by Year(createtime)

使用时遇到的问题

SELECT 子句中包含一个保留字、拼写错误或丢失的参数,或标点符号不正确。

把你任务是关键字的字段使用[]括起来,比如:name字段,查询时写成[name]即可。

如果觉得《access 数据库写按日期查询SQL》对你有帮助,请点赞、收藏,并留下你的观点哦!

本内容不代表本网观点和政治立场,如有侵犯你的权益请联系我们处理。
网友评论
网友评论仅供其表达个人看法,并不表明网站立场。