title: Error comparing and fetching records in SQLite
body: <p>I have this table</p>
  <p>table1</p>
  <pre><code>---------------
  nums          |   
  ---------------
  1             |
  2             |
  8             |
  32            | 
  11            |
  31            |
  28            |
  17            |
  38            | 
  14            | 
  --------------
  </code></pre>
  <p>then I have this table</p>
  <p>table2</p>
  <pre><code>--------------------
  DRAWNUMBER|n1|n2|n3|
  --------------------
  39494     |2 |23|34|
  28288     |8 |12|11|
  23000     |11|32|20|
  90000     |14|28|38|
  30000     |22|18|11|
  10000     |32|39|18|
  -------------------
  </code></pre>
  <p>with this query I fetch the numbers of the main draw(Grouped)from table2</p>
  <pre><code>SELECT (&quot; &quot;||n1||&quot;-&quot;||n2||&quot;-&quot;||n3 )NUMBERS FROM(SELECT n1,n2,n3, max(DRAWNUMBER) FROM table2)
  </code></pre>
  <p>Results:</p>
  <pre><code>----------
  NUMBERS  |   
  ---------|
  14-28-38 |
  ----------
  </code></pre>
  <p>Now what I need to do is to bring in table 1 only the numbers that are in table 2.</p>
  <p>With this query I try to make a comparison but I get all the numbers from table 2.</p>
  <pre><code>SELECT nums from table1 WHERE EXISTS(SELECT (&quot; &quot;||n1||&quot;-&quot;||n2||&quot;-&quot;||n3)FROM(SELECT n1,n2,n3, max(DRAWNUMBER) FROM table2))
  </code></pre>
  <p>Results:</p>
  <pre><code>---------------
  nums          |   
  ---------------
  1             |
  2             |
  8             |
  32            | 
  11            |
  31            |
  28            |
  17            |
  38            | 
  14            | 
  --------------
  </code></pre>
  <p>Expected:</p>
  <pre><code>---------------
  nums          |   
  ---------------
  14            |
  28            | 
  38            | 
  --------------
  </code></pre>
  <p>If instead I want to fetch the numbers from table1 that ARE NOT in table2 it simply returns empty.</p>
  <pre><code>SELECT nums from table1 WHERE NOT EXISTS(SELECT (&quot; &quot;||n1||&quot;-&quot;||n2||&quot;-&quot;||n3)FROM(SELECT n1,n2,n3, max(DRAWNUMBER) FROM table2))
  </code></pre>
  <p>Results:</p>
  <pre><code>---------------
  nums          |   
  ---------------
                | 
  --------------
  </code></pre>
  <p>I don't know what is wrong with the query. I have already changed the EXISTS to = and I have also used operator &lt;&gt; but it does not meet my expectations. Thanks in advance.-</p>