Skip to content
Advertisement

Oracle SQL – create select statement which will retrieve every end date of the month but compare the values the day or two after the end of month

Let’s say I have a customer table.

I need to create a select statement which will retrieve every end date of the month and compare the values for the amounts respective to the day or two after. If the amount for the day or two is different from the end date of that month, display the recent changed amount.

Example 1 – Retrieve customer A for 31-OCT-20, compare to 01-NOV-20 and 02-NOV-20, output 200 for the amount.

Example 2 – Retrieve customer B for 31-OCT-20, compare to 01-NOV-20 and 02-NOV-20, output 350 for the amount.

Advertisement

Answer

Hmmm . . .

User contributions licensed under: CC BY-SA
8 People found this is helpful
Advertisement