Not the answer you need?
Register and ask your own question!

How can we use FIND_IN_SET() function with MySQL WHERE clause?

luanvanvietluanvanviet EntrantLegacy User Role Novice
I want to use MySQL FIND_IN_SET () function on the values stored in MySQL table. While using it, I also want to put some conditions on the data. I want to know that how I can use MySQL FIND_IN_SET () function with WHERE clause.

Comments

  • lorraine.pocklingtonlorraine.pocklington Percona Community Manager Legacy User Role Patron
    Hi, there are some examples on this page http://www.mysqltutorial.org/mysql-find_in_set/
  • keithedwardskeithedwards Entrant Legacy User Role Contributor
    I want to use MySQL FIND_IN_SET () function on the values stored in MySQL table. While using it, I also want to put some conditions on the data. I want to know that how I can use MySQL FIND_IN_SET () function with WHERE clause.

    Hi luanvanviet, not sure what data set are you working with, but here's a simple example of how it will be to find the division that accepts red belt, you can use the FIND_IN_SET function as follows:

    [HTML]
    SELECT
    name, belts
    FROM
    divisions
    WHERE
    FIND_IN_SET('red', belts);
    [/HTML]

    Let me know if that makes sense.
Sign In or Register to comment.

MySQL, InnoDB, MariaDB and MongoDB are trademarks of their respective owners.
Copyright ©2005 - 2020 Percona LLC. All rights reserved.