0

I stumbled across a strange expression, which doesn't make sense to me at all.

SELECT * FROM `table` WHERE FIND_IN_SET('string', `column`);

Why not:

SELECT * FROM `table` WHERE `column`='string';

I thought FIND_IN_SET is used to find strings in comma-separated string lists. Are there cases where I can benefit from a "FIND_IN_SET"-column expression instead of a simple WHERE?

Zoe
  • 27,060
  • 21
  • 118
  • 148
ulbiopro
  • 3
  • 3

1 Answers1

0

FIND_IN_SET is usually used other way around: to find a column value from comma separated parameter list as storing values in database as comma separated lists is not usually a good idea:

select * 
FROM `table` 
WHERE FIND_IN_SET(`column`, '1,2,3,4,5');
Zoe
  • 27,060
  • 21
  • 118
  • 148
slaakso
  • 8,331
  • 2
  • 16
  • 27