Posted By

apphp-snippets on 08/14/13


sql tags in

Versions (?)

Search in Tags Set in MySQL

 / Published in: PL/SQL


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.

  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  

You need to login to post a comment.