我目前定期运行此操作以在几列上预处理空字符串和“-1”为空。有什么方法可以找出最后一行经历了 nullif 操作或有 '' 或 -1 以便我可以从那时起处理所有内容。我的表有一个时间戳列。我有 150 列,例如 recovery_email,我想从在其中任何一个中找到的最后一个空字符串开始。或者在 sql 表中插入这些记录时我做了什么?
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)