How can I check with SQL if a column contains a comma seperated list / string?
My query looks like this:
$modulare = $this->Database->prepare("
SELECT id, titel, sorting, kuerzel
FROM cc_produkte
WHERE veroeffentlichen = 1
AND kuerzel = ? // Here commas have to be filtered
ORDER BY sorting, id ASC
")
->execute($pid);
The "kuerzel" column contains the shortcuts of individual products as a comma-separated string. But there are also products that have only a shortcut. Only one of the entries should be read. Unfortunately I can not do anything with the linked post.
Is there a possibility in SQL for this? For example, how does the explode function of PHP?