I have a value (IP Address) in TableA. If this value does not exist in the comma separated value field in TableB I need to delete the row in TableA. I can retrieve these IP's with the following but I have to repeat for each entry in the CSV String. The number of values in TableB's CSV String column can fluctuate. My Stringsplit function is a simple Parsing (Substr()) of the string the comma and position are the parameters. The last parameter needs to increase each pass until done
*SELECT * FROM TableA AS A
JOIN `TableB` AS B ON B.ID = A.ID
WHERE
A.`column` <> stringsplit(B.`Column`,',',1) AND
A.`column` <> stringsplit(B.`Column``,',',2) AND
A.`column` <> stringsplit(B.`Column`,',',3) AND
ETC......
I can obtain an accurate count of these values by:
SELECT CASE WHEN TableB.Column = '' THEN 0 ELSE (LENGTH(TableB.Column`) - LENGTH(REPLACE(TableB Column, ',', ''))+1) END AS value_count
FROM `TableB`*
How can this be done dynamically adjusting the parameter in the Stringsplit() to increase with each pass?