0

I am looking to write an efficient query to match a comma separated list of integers to match on a comma separated column.

The tables would look like:

Words

  1. id
  2. word
  3. versionId ( comma separated, ex: 1,3 )

I want a where clause where I get all words that are in version 1 and 4. Is there an efficient way of doing this on a table with 20,000+ words?

I am trying to use FIND_IN_SET( $versions, words.versionId ) where $versions is a comma separated list, but that does not work. The other solution I saw online was to make many FIND_IN_SET(..) clauses and combine them with an OR, but I dont see that scaling very well. Am I missing a solution?

Ice76
  • 1,143
  • 8
  • 16
  • To provide an answer it helps a lot to get **sample data**, **expected results** and the **existing query**. – Paul Maxwell Sep 21 '18 at 00:38
  • @Used_By_Already I've come to this problem just now, and have been trying. I tried to using the comma separated needle, but that does not work for FIND_IN_SET. Im hoping that I am missing something, or there is a different solution I can use instead of combining many `FIND_IN_SET(... )` by `OR`s. – Ice76 Sep 21 '18 at 00:40

0 Answers0