On the SQL below it finds "bad rows" in my excel sheet and copies them into another table. This works perfect. However under each OR satement below i want to make the column "rejectionreason" = some error text. So for example if the eventID was = 0 then move the row to the table but also update the column "rejectionreason" to the text "Error the eventID was equals to 0".
I also need to do similar for all the other OR statements below.
How can i do this
SQL
REPLACE INTO InvalidBaseDataTable SELECT * FROM BaseDataTable where dateTime = '0000-00-00 00:00:00'
OR eventId = 0
OR ueType = 0
OR eventId NOT IN (SELECT DISTINCT(eventId) FROM EventCauseTable)
OR causeCode < (SELECT MIN(causeCode) FROM EventCauseTable)
OR causeCode > (SELECT MAX(causeCode) FROM EventCauseTable)
OR ueType NOT IN (SELECT DISTINCT(tac) FROM UeTable)
OR
(eventId NOT IN (SELECT DISTINCT(eventId) FROM EventCauseTable)
AND
causeCode NOT IN (SELECT DISTINCT(causeCode) FROM EventCauseTable))