所有季度,SQL 10年的PAS月份
我想在过去的10年中使用查询来检索所有季度 -
SELECT TO_CHAR(sysdate, 'yyyy" Q "')||level AS QuarterDate
FROM dual
CONNECT BY level <= 4
使用上述查询,我将获得当年的四分之一。我想过去十年。
Similary,是否有一种方法可以在过去10年中以同样的方式获得所有几个月的时间
SELECT DISTINCT to_char(sysdate, 'yyyy / mm') from dual
,是否有一种方法可以超越整个10年。
I want to retrieve all the quarters in the past 10 years using the query -
SELECT TO_CHAR(sysdate, 'yyyy" Q "')||level AS QuarterDate
FROM dual
CONNECT BY level <= 4
Using above query I will get quarter for current year. I want for past 10 years.
Similary, is there a way to get all months in past 10 years in the format-
SELECT DISTINCT to_char(sysdate, 'yyyy / mm') from dual
Similarly, is there a way to get past all 10 years.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您可以使用Trick相同的连接来生成数年,几个月,几个月,几个月,日期等:
您还可以使用广泛的格式代码生成大量的日期和过滤/格式化/格式化/格式化:
you can generate years, months, quarters, days, etc using the same connect by trick and just joining them together:
You can also just generate a large set of dates and filter/format the ones you want using the extensive format codes: