I currently run this operation regularly to preprocess empty strings and '-1' to null on several columns. Is there any way to find out the last row that has gone through nullif operation or has '' or -1 so I can process everything from that point. My table has a timestamp column. I have 150 columns like recovery_email and I'd like to start from the last empty string that was found in either of them. Or is there anything I do while inserting these records in sql table?
UPDATE table
SET recovery_email = NULLIF(recovery_email, ''), # There are 150 columns like recovery_email.
email = NULLIF(email, ''),
.
.
n
WHERE timestamp >= (NOW() - INTERVAL 1 DAY)
UPDATE table
SET recovery_email = NULLIF(recovery_email, -1), # There are 150 columns like recovery_email.
email = NULLIF(email, -1),
.
.
n
WHERE timestamp >= (NOW() - INTERVAL 1 DAY)