Skip to content
Advertisement

Getting values based on other column

I have the following data in SQL.

Is there a way using SELECT QUERY that we can replace the NULL values in DATE column based on the REF values?

Like replace the NULL values with the first available date for matching REF value, without making any change to the database.

Expected Result

Advertisement

Answer

You can do it with MAX() window function:

See the demo.

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