Mysql FIND_IN_SET()

FIND_IN_SET() : A function that I discovered some years ago and which I find very impressive if you’re addicted to query optimization.
This function is a bit like in_array() but is doing research in StringList separated by commas “,”

Here is an example to understand:

Table : Clubs
table_clubs

Table : Leagues
championnats

To select leagues which participates BARCA (having id 11), SQL code would look like this :

SELECT    league_id,name
FROM      Leagues
WHERE     FIND_IN_SET(11, clubs_id)

Leave a comment

Your comment