title: Avoid duplicate rows in SQL query
body: <p>I use the following SQL query on SQL Server 2008 to select rows from <code>products</code> and <code>categories</code> tables.</p>
  
  <pre><code>SELECT products.idProduct,  sku, description, listPrice, 
     smallImageUrl, isBundleMain, rental, visits 
  FROM products, categories_products 
  WHERE products.idProduct = categories_products.idProduct 
  AND categories_products.idCategory = "&amp; pIdCategory&amp;" 
  AND listHidden=0 
  AND active=-1 
  AND idStore = " &amp;pIdStore&amp; "
  ORDER BY description
  </code></pre>
  
  <p>The problem is that some rows are duplicate. Those duplicates are generally determined by <code>products.idProduct</code> column, so I want to change the  query so that the same <code>products.idProduct</code> doesn't appear twice, means for example one of the rows has <code>products.idProduct = 3438</code> and the other row has same product id as well only one of the <code>products.idProduct</code> gets displayed</p>