Search in Tags Set in MySQL

/ Published in: PL/SQL
Save to your folder(s)

Lets say you have a table with field called "tags" that consists from tags separated by commas and you want to check whether it includes a required tag. Here the simplest ways of doing that.

Copy this code and paste it in your HTML
  1. -- 1st way
  2. WHERE FIND_IN_SET(" '.$tag.'", CONCAT(" ", TABLE.tags))
  3. LIMIT 1;
  5. -- 2st way
  6. WHERE '.$tag.' IN(TABLE.tags)
  7. LIMIT 1;


Report this snippet


RSS Icon Subscribe to comments

You need to login to post a comment.