0

I have the following input table "eastate_facilitylist":

eastate_id facilityList
1 2,3,4
2 1,3,4
3 1

I want to select the "eastate_id" values that have a value inside it, so I've crafted the following query:

SELECT eastate_id FROM `eastate_facilitylist` 
WHERE ( FIND_IN_SET(3, facilityList))

Problem is that it returns an empty result set.

I'm using MySQL 5.7.31.

How can I fix my query?

lemon
  • 14,875
  • 6
  • 18
  • 38
  • 3
    I suspect that there are spaces between the numbers in the lists of facilityList. – forpas Aug 03 '22 at 21:48
  • yes, spaces between the text seems likely, but still you should read https://stackoverflow.com/questions/3653462/is-storing-a-delimited-list-in-a-database-column-really-that-bad as FIND_IN_SET costs much performamce – nbk Aug 03 '22 at 21:51
  • I cannot reproduce your issue https://dbfiddle.uk/?rdbms=mysql_5.7&fiddle=449073d6e12f9f46c7cf415374e358ba – P.Salmon Aug 04 '22 at 06:51

0 Answers0