Domanda

Is it possible to search for an array of numbers in a comma separated column?

I know that this is possible

SELECT * FROM products WHERE FIND_IN_SET('1', '1,3,5') > 0

But is this possible too?

SELECT * FROM products WHERE FIND_IN_SET('1,2', '1,3,5') > 0

If 1 or 2 be in the column it should return > 0

if you know another method just let me know

thank you

È stato utile?

Soluzione

No, but you can use find_in_set multiple times

SELECT * FROM products
WHERE FIND_IN_SET(1, '1,3,5') > 0
   OR FIND_IN_SET(2, '1,3,5') > 0
Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top