title: MySQL Filtered Join
body: <p>This seems like it would work, but telling to show records whose value is NOT zero, all seems to be telling it to not show records whose value is NULL. (that is records that are not in tableB). Seems 0 is equal to NULL in mysql. How do get the result I'm looking for?</p>
  
  <pre><code>SELECT DISTINCT Name, CategoryID
  FROM sockcategory 
  LEFT JOIN sockcategoryparentxref ON 
  sockcategory.CategoryID = sockcategoryparentxref.Category_ID 
  WHERE CategoryParentID !=0;
  </code></pre>
  
  <p>Schema / Sample Data</p>
  
  <p>Table <code>sockcategory</code>:</p>
  
  <pre><code>+-----------+------------+
  |   Name    | CategoryID |
  +-----------+------------+
  | Red       |          1 |
  | Blue      |          2 |
  | Green     |          3 |
  | Colors    |          4 |
  | Wholesale |          5 |
  +-----------+------------+
  </code></pre>
  
  <p>Table <code>sockcategoryparentxref</code>:</p>
  
  <pre><code>+-------------+------------------+
  | Category_ID | CategoryParentID |
  +-------------+------------------+
  |           1 |                4 |
  |           2 |                4 |
  |           3 |                4 |
  |           4 |                0 |
  +-------------+------------------+
  </code></pre>
  
  <p>Desired output:</p>
  
  <pre><code>+-----------+------------+
  |   Name    | CategoryID |
  +-----------+------------+
  | Red       |          1 |
  | Blue      |          2 |
  | Green     |          3 |
  | Wholesale |          5 |
  +-----------+------------+
  </code></pre>