【发布时间】:2021-08-21 10:14:39
【问题描述】:
在我的例子中,我们有一个表 ABC,其中假定有 1 行。
| id | name | start_date | end_date |
|---|---|---|---|
| 1 | Rahul | 01/01/2021 | 06/01/2021 |
但在检索时,我想获得多行,其中开始日期递增 1,直到它小于或等于结束日期。
| id | name | start_date | end_date |
|---|---|---|---|
| 1 | Rahul | 01/01/2021 | 06/01/2021 |
| 1 | Rahul | 02/01/2021 | 06/01/2021 |
| 1 | Rahul | 03/01/2021 | 06/01/2021 |
| 1 | Rahul | 04/01/2021 | 06/01/2021 |
| 1 | Rahul | 05/01/2021 | 06/01/2021 |
| 1 | Rahul | 06/01/2021 | 06/01/2021 |
请告诉我我们该怎么做。
【问题讨论】:
标签: sql database postgresql recursive-query