Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>The only way that the queries would have the same results is if the <code>tareas</code> join matched every record (in the preceding from..inner join set) <em>exactly once</em>.</p> <p>If the first query results in <em>more</em> rows, then the <code>tareas</code> contains duplicates records per the join predicate (i.e. it has duplicate <code>idclientecrm</code> values). This why the records must be matched <em>exactly once</em> for the same result set. (If this was meant to be a 1-1 relationship then some constraints were not setup correctly .. whoops!)</p> <p>Consider this simple <a href="http://en.wikipedia.org/wiki/Join_%28SQL%29#Inner_join" rel="nofollow">inner join</a> example showing the outcome with different multiplicities:</p> <pre><code>A &lt;- { 1, 2, 4 } B &lt;- { 1, 2(#1), 2(#2), 3 } A join B =&gt; { 1, 2(#1), 2(#2) } </code></pre> <p>Reason for result:</p> <ul> <li>A.1 match B.1 - this is the only record that matched <em>exactly once</em></li> <li>A.2 match B.2(#1)</li> <li>A.2 match B.2(#2)</li> <li>A.4 no match</li> <li>B.3 no match</li> </ul> <p>I think that this excerpt from Wikipedia explains the concept well:</p> <blockquote> <p>The result of the join can be defined as the outcome of <em>first taking the Cartesian product (or Cross join) of all records</em> in the tables (combining every record in table A with every record in table B)—then <em>return all records which satisfy the join predicate</em>.</p> </blockquote> <p>(This why a CROSS JOIN with a WHERE can return the same results as an INNER JOIN - ick, though!)</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.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      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