Skip to Main Content

SQL Developer

Announcement

For appeals, questions and feedback, please email oracle-forums_moderators_us@oracle.com

SQL Query - consecutive week count.

user12099355Feb 7 2024

Table name is T_TEST

empNo WeekNo

E123  2023-01

E123  2023-02

E123  2023-03

E123  2023-04

E123  2023-05

E123  2023-06

E123  2023-12

E123  2023-13

E123  2023-14

E123  2023-15

E456  2023-01

E456  2023-02

E456  2023-03

E456  2023-14

E456  2023-15

Desired result returning a bucket field with the total consecutive week count:

empNo WeekNo      Bucket

E123  2023-01     6

E123  2023-02     6

E123  2023-03     6

E123  2023-04     6

E123  2023-05     6

E123  2023-06     6

E123  2023-12     4

E123  2023-13     4

E123  2023-14     4

E123  2023-15     4

E456  2023-01     3

E456  2023-02     3

E456  2023-03     3

E456  2023-14     2

E456  2023-15     2

Regards,

Tonito,

This post has been answered by cormaco on Feb 7 2024
Jump to Answer
Comments
Post Details
Added on Feb 7 2024
4 comments
73 views