0

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)  
  • This looks very similar to [your previous question](https://stackoverflow.com/questions/61581845/how-to-find-last-row-that-ran-nullif-or-has-null-in-mysql). – GMB May 05 '20 at 00:11
  • Yes, I didn't write it quite correctly and it doesn't allow me to delete it. This one is written correctly. or it'd great if you can edit your previous answer to meet the new constraint I added about the search of these empty strings throughout the columns and not just recovery_email. –  May 05 '20 at 00:37

0 Answers0