Note that there are some explanatory texts on larger screens.

plurals
  1. POSQL not recognizing equal values
    primarykey
    data
    text
    <p><strong>UPDATE:</strong> I figured out a large part of what caused my problem. When I queried the database to find the data type, it correctly returned CHAR(4) for t2.sale_code.</p> <p>However, the GUI did not display leading zero's. t3.sale_code did not have leading zeros in the file that populated the table. That's what caused my confusion and I corrected the zero problem. Now it joins without any CAST or other manipulation.</p> <p><em><strong></em>__<em>_</em>__<em>_</em>__<em>_</em>__<em>_</em>__<em>_</em>__<em>_</em>__<em>_</em>__<em>_</em>__<em>_</em>__<em>_</em>__<em>_</em>__<em>_</em>__<em>_</em>__<em>_</em>__<em>_</em>____</strong>_I have a query:</p> <pre><code>SELECT t1.id, t2.sale_code, t3.sale_code, t3.title FROM t1 INNER JOIN t2 ON t1.id = t2.id INNER JOIN t3 ON t3.id = t2.id </code></pre> <p>There are some different one-to-many relationships that I can't control that induce duplication. I need to do this:</p> <pre><code>WHERE t2.sale_code = t3.sale_code </code></pre> <p>However, this just won't work. I'm not sure what I'm doing wrong. I can manually make it work:</p> <pre><code>SELECT t1.id, t2.sale_code, t3.sale_code, t3.title FROM t1 INNER JOIN t2 ON t1.id = t2.id AND t2.dt &gt; t1.dt_active AND t2.dt &lt; t1.dt_inactive INNER JOIN t3 ON t3.id = t2.id WHERE t2.sale_code = 4 AND t3.sale_code = 4 </code></pre> <p>For example, this returns a proper matched pair of <code>sale_code</code>'s. However, when I compare them directly (`WHERE t2.sale_code = t3.sale_code) it returns no results. Am I doing something wrong here?</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload