title: How to exclude records which don't match a LEFT JOIN from a SELECT in MySQL?
body: <p>I'm trying to get a product search to work properly in MySQL 5.0.88.</p>
  
  <p>Basic setup: I have table A with products </p>
  
  <pre><code>A.id
  A.ean
  A.styleNo
  A.price
  A.seller (ID e.g. 123, 456)
  </code></pre>
  
  <p>And a table B with pricelists</p>
  
  <pre><code>B.name
  B.ean
  B.alt_price
  B.seller
  </code></pre>
  
  <p>Sellers can define optional pricelists, which are matched to the user doing the search. My search more or less looks like this: </p>
  
  <pre><code>    SELECT A.styleNo, A.price, B.price
      FROM arts A
          LEFT JOIN pricelists B ON
                  B.seller = A.seller 
              AND B.ean = A.ean 
              AND B.alt_price != 0
      WHERE...
      // pricelists
      AND ( B.name = "some_name" AND B.seller = "123" ) OR ( next applicable seller ) ...
  </code></pre>
  
  <p>So after the LEFT JOIN, I'm including all items from a pricelist by name and seller. </p>
  
  <p>This works ok as it selects both the regular price (A) and alt_price (B) and I can check for existing alt_price when displaying the results to show the correct price to the user.</p>
  
  <p>However if the seller does not give an <strong>alt-price</strong> to all of his products, I'm now displaying the product with the price from A, when in fact I DON'T want to display products from this seller which do not have a pricelist entry at all (think regional assortment). </p>
  
  <p>So if user X has a pricelist "abc" and seller 123 has 500 products, 200 of which are on the pricelist "abc", I only want to display the 200 products and not 500 with 200 in the correct price.</p>
  
  <p>I tried to use <strong>B.alt_price != 0</strong> in the LEFT JOIN, but this doesn't help, because all items on there have a price.  </p>
  
  <p><strong>Question</strong><br>
  Is there a way to do this in the actual search or do I have to do it in the results loop, which I'm not really keen on doing. </p>