Skip to Main Content

SQL & PL/SQL

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Interested in getting your voice heard by members of the Developer Marketing team at Oracle? Check out this post for AppDev or this post for AI focus group information.

Compare intervalls

MarwimJan 28 2025

Oracle Database 19c Enterprise Edition Release 19.0.0.0.0 - Production
Version 19.21.0.0.0

Two tables A and B. Each has gapless date intervalls.
dat_from is not null, the last dat_to can be null
The intervalls don't necessarily start/end at the same date
Each intervall has an amount
I need intervalls that have the max of each

Data for each month

   Dez Jan Feb Mar Apr May Jun Jun Aug Sep Oct Nov Dec Jan
A    1 - 1 - 1   2 - 2 - 2   1 - 1 - 1   0 - 0 - 0   1 - 1
B    x   0 - 0 - 0   2 - 2 - 2   1   0 - 0 - 0 - 0 - 0   x
Max  1 - 1 - 1   2 - 2 - 2 - 2   1 - 1   0 - 0 - 0 - 0   1

Expected output similar to

2023/12 - 2024/02 1
2024/03 - 2024/06 2
2024/07 - 2024/08 1
2024/09 - 2024/11 0
2024/12 -         1
WITH tab_a AS (
SELECT  DATE '2023-12-01' dat_from, DATE '2024-02-29' dat_to, 1 amount FROM dual UNION ALL
SELECT  DATE '2024-03-01' dat_from, DATE '2024-05-31' dat_to, 2 amount FROM dual UNION ALL
SELECT  DATE '2024-06-01' dat_from, DATE '2024-08-31' dat_to, 1 amount FROM dual UNION ALL
SELECT  DATE '2024-09-01' dat_from, DATE '2024-11-30' dat_to, 0 amount FROM dual UNION ALL
SELECT  DATE '2024-12-01' dat_from, NULL              dat_to, 1 amount FROM dual
)
,tab_b AS (
SELECT  DATE '2024-01-01' dat_from, DATE '2024-03-31' dat_to, 0 amount FROM dual UNION ALL
SELECT  DATE '2024-04-01' dat_from, DATE '2024-06-30' dat_to, 2 amount FROM dual UNION ALL
SELECT  DATE '2024-07-01' dat_from, DATE '2024-07-31' dat_to, 1 amount FROM dual UNION ALL
SELECT  DATE '2024-08-01' dat_from, DATE '2024-12-31' dat_to, 0 amount FROM dual
)
SELECT ???

Best Regards
Marcus

This post has been answered by James Su on Jan 28 2025
Jump to Answer

Comments

chonewell Nov 12 2024

My Oracle Cloud tenant, cloud account, and secure email have no issues. Why haven't I received my password reset email for Oracle Cloud? This is very strange, and our attempts have not been able to solve the problem. May I ask who I should turn to for help?

L. Fernigrini Nov 12 2024

If your account is a paid one, open a Support ticket.

If it is a Free Tier then you will have to rely on help from the community. Most probable cause that you did not receive the password reset email is that your account has been stolen and the email has been changed.

chonewell Nov 13 2024

Thank you for your reply!
But when I chatted with the online customer service, they told me that my Oracle Cloud tenant, account, and email were all fine. So, there shouldn't be a problem of theft.
I have a free account, but who can I contact on the forum? I can only post, but no one on the forum can view my account permissions, right. I am currently trying to reset MFA, I don't know if it works.
It's quite ridiculous that I have a free account and can't enjoy any services, but how can I become a paid user if I can't log in to my account.

1 - 3

Post Details

Added on Jan 28 2025
11 comments
219 views