title: How to concatenate a Select query inside a INSTR() in SQLite?
body: <p>I was trying to order a result set by the order of the values in an IN() clause.</p>
  <pre><code>SELECT * FROM CrossReference WHERE cross_reference_id IN (SELECT Id FROM FilteredIds) 
  </code></pre>
  <p>So I tried to find a function such as MySql FIELD(). Then I found these answers (<a href="https://stackoverflow.com/a/67397081">answer1</a>, <a href="https://stackoverflow.com/a/58224066/9844805">answer2</a>) which explain how to do the exact thing on SQLite using the INSTR().</p>
  <pre><code>SELECT *, INSTR(',GDBR10,GDBR5,GDBR30,', ',' || ticker || ',') POS
  FROM tbl
  WHERE POS&gt;0
  ORDER BY POS;
  </code></pre>
  <p>So it's working as expected, but I want to populate the ids dynamically using a select query. I tried many approaches, but nothing seemed to work. Here is the last one I tried. It gave me just one result row (a result related to the first filterId).</p>
  <pre><code>SELECT *, INSTR (','||(SELECT id FROM FilteredIds)||',', ',' || cross_reference_id || ',') POS FROM CrossReference WHERE POS&gt;0 ORDER BY POS;
  </code></pre>
  <p>So I guess I'm making some kind of mistake when concatenating the SELECT query with the rest of the code. Because when I manually enter the filtered Ids it works and returns results according to  the entered filter ids.</p>