In the table tags I have the field id. In the table tastings I have a field tags which is a list of id numbers separated by commas, for example 2,4,5. The database is MySQL.
Now I am trying to count how many times each tag is used in total. But I am stuck with the LIKE part. I have tried the following, all giving a syntax error:
SELECT tags.id, tag, FROM tags, tastings WHERE tags LIKE tags.id + '%'
SELECT tags.id, tag, FROM tags, tastings WHERE tags LIKE tags.id & '%'
SELECT tags.id, tag, FROM tags, tastings WHERE tags LIKE CONCAT(tags.id, '%')
What am I doing wrong?
||.