Skip to Main Content

SQL to update missing data in a record with data from latest complete record

Aurelian ConstantinSep 15 2022 — edited Sep 15 2022

The unique identifier is email address.
Some users (identified by their email address), forget to update some columns in their record.
I need a solution to this problem..
For the users that have already at least one complete record, I need to write an SQL statement that updates the missing data/columns for these users with data found in their latest corresponding complete record.
User identified by email address has at least one complete record (phone and birthdate are not null): | phone | birthdate
The same user inserts another record but forgets to declare the phone and the birthdate.
I need to write a SQL statement that updates the record which has null in the phone and birthdate, with phone and birthdate data found in the latest complete record (where the phone and birthdate data are not null).
Thank you for your time!

Post Details
Added on Sep 15 2022