使用递归 CTE 获取给定月份和月份的逗号分隔月份
我们要求提供 2 个月和 2 年作为输入。结果应提供以逗号分隔的月年和从月年到月年之间的所有月份。
假设我们有
From Month is 'Jan'
From Year is 2011
To Month is 'Apr'
To Year is 2011
想要的输出,
Jan'11,Feb'11,Mar'11,Apr'11
这可以使用递归 CTE 来实现吗?我们需要使用递归 CTE 来实现这一点。有人可以帮我解决这个问题吗?
We have requirement where 2 months and 2 years are provided as input. And the result should provide a comma separated month-year all the months between the from month-year and to month-year.
Say, we have
From Month is 'Jan'
From Year is 2011
To Month is 'Apr'
To Year is 2011
desired output
Jan'11,Feb'11,Mar'11,Apr'11
Can this be achieved using recursive CTE? We need to achieve this using recursive CTE. Could somebody help me on this.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
试试这个代码:
结果:
在这里测试:
https://data.stackexchange .com/stackoverflow/q/114801/变量声明
Try this code:
Result:
Test here:
https://data.stackexchange.com/stackoverflow/q/114801/declaration-of-variables