Note that there are some explanatory texts on larger screens.

plurals
  1. POLEFT OUTER JOIN keep all matched results from first table use where just for second table
    primarykey
    data
    text
    <p>When I try to execute the mysql query below here I won't return all the record id's giving in the WHERE clause.</p> <p>What I am trying to do:</p> <ol> <li>Get all result records by id (IN)</li> <li><p>JOIN the second table (websites_thumbs) By website_salt of Table 1 record result</p> <p><em>By salt of the record from table 1 but also a salt from the parent site ($parent_salt)</em></p></li> <li><p>SUM votes and return in record result (if no result in the second table is found return 0)</p></li> </ol> <p>ID 119 and 250 are having voting results in the second table, the others doesn't. The problem I got is when I execute the query it returns just the records 1,119 &amp; 250 the other id's are existing but they are not returned?</p> <p>The query:</p> <p>// VxZQ85cByb98wUx0f3 => parent salt coming from another query (page data query)</p> <pre><code>SELECT SUM(CASE t.thumb when 1 then 1 else 0 end) as thumbs_up, SUM(CASE t.thumb when -1 then 1 else 0 end) as thumbs_down, w.*, t.* FROM websites as w LEFT OUTER JOIN websites_thumbs AS t ON t.similar_website_salt = w.salt AND t.website_salt = 'VxZQ85cByb98wUx0f3' WHERE w.id IN ('1', '20', '31', '4', '199', '250', '633953') GROUP BY t.similar_website_salt </code></pre> <p>first table</p> <p><img src="https://i.stack.imgur.com/a2Zk2.png" alt="enter image description here"></p> <p>second table <img src="https://i.stack.imgur.com/Cz3gm.png" alt="enter image description here"></p> <p>Executing result</p> <p><img src="https://i.stack.imgur.com/hHsoM.png" alt="enter image description here"></p> <p>Hope someone can help me with this on!</p> <p>Thanks</p>
    singulars
    1. This table or related slice is empty.
    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. 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