我在 ORACLE 数据库中有一个表,详细信息如下:
--------------------------------------------
| FRUITS |
--------------------------------------------
| FRUIT_NAME | GROWTH_TIME | GROWTH_PLACE |
--------------------------------------------
| melon | 0600 | shelf1 |
| melon | 0630 | shelf1 |
| melon | 0700 | shelf1 |
| melon | 0730 | shelf1 |
| melon | 0800 | shelf1 |
| orange | 0600 | shelf5 |
| orange | 0630 | shelf5 |
| orange | 0700 | shelf5 |
| orange | 0730 | shelf5 |
| orange | 0800 | shelf5 |
| orange | 0830 | shelf5 |
| orange | 0900 | shelf5 |
| orange | 0930 | shelf5 |
| orange | 1000 | shelf5 |
| orange | 1200 | shelf5 |
| orange | 1230 | shelf5 |
| orange | 1300 | shelf5 |
| orange | 1330 | shelf5 |
| orange | 1400 | shelf5 |
| apple | 0600 | shelf3 |
| apple | 0630 | shelf3 |
| apple | 0700 | shelf3 |
| apple | 0730 | shelf3 |
| apple | 0800 | shelf3 |
--------------------------------------------
我想得到如下结果:
--------------------------------------------
| FRUIT_NAME | GROWTH_TIME | GROWTH_PLACE |
--------------------------------------------
| melon | 0600-0800 | shelf1 |
| orange | 0600-1000 | shelf5 |
| orange | 1200-1400 | shelf5 |
| apple | 0600-0800 | shelf3 |
或像这些:
-------------------------------------------------------------------
| FRUIT_NAME | GROWTH_START_TIME | GROWTH_END_TIME | GROWTH_PLACE |
-------------------------------------------------------------------
| melon | 0600 | 0800 | shelf1 |
| orange | 0600 | 1000 | shelf5 |
| orange | 1200 | 1400 | shelf5 |
| apple | 0600 | 0800 | shelf3 |
ORANGE 表壳有一个小间隙(在 1000 和 1400 之间),这仍然是同一个架子,但时间上的差距很小。它发生了,但我不知道如何解决这个问题。