如何在 MSaccess 中按带有月份和年份的降序日期列进行排序



我希望按每月新发行的显示顺序应该从最新的列表顶部到列表底部的最旧,例如 2049 年 11 月、2049 年 8 月、2046 年 12 月、2046 年 10 月、2046 年 3 月、2012 年 11 月、2012 年 10 月、2012 年 9 月......

我尝试使用以下查询:

select format(newissue,"yyyy"),newissue  from (SELECT distinct format(dateofissue,"mm/yyyy") as newissue from products order by format(dateofissue,"mm/yyyy") )order by format(newissue,"yyyy") desc

并得到以下结果。

Query Result   Expected result what i need
------------   ----------------------------
November 2049   November 2049 
August 2049     August 2049
march 2046      December 2046
October 2046    October 2046
December 2046   March 2046

请帮助我,以获得所需的查询输出。

谢谢

你的意思是:

select distinct format(dateofissue,"mmmm yyyy")
from products 
order by dateofissue desc

选择格式(新期,"YYYY")作为日期问题1,新问题作为 日期问题2,格式(新问题,'mmmm yyyy') 作为日期问题3 从(选择) 不同格式(发行日期,"月/年")作为产品订单中的新发行 按格式(日期问题,"月/年") )按格式排序(新问题,"YYYY") desc ,format(newissue,'MM') desc

最新更新