title: How to SQL distinct on only one column
body: <p>I'm trying to apply <code>DISTINCT</code> on only one column. </p>
  
  <p>The question is:</p>
  
  <blockquote>
    <p>Who is ordering equipment where the description begins with "tennis" or "volleyball".</p>
    
    <p>Include:</p>
    
    <ol>
    <li>Customer number,</li>
    <li>Stock number, and</li>
    <li>Description</li>
    </ol>
    
    <p>Do not repeat any rows.</p>
  </blockquote>
  
  <p>This is what the tables look like: <a href="https://i.stack.imgur.com/HqwHa.jpg" rel="nofollow noreferrer"><code>Items</code>, <code>Stock</code>, <code>Orders</code></a></p>
  
  <p>This is my code: </p>
  
  <pre><code>select distinct 
      orders.customer_num, stock.stock_num, stock.description
  from 
      orders
  join 
      items on items.order_num = orders.order_num
  join 
      stock on stock.stock_num = items.stock_num
  where 
      stock.description like 'tennis%' 
      or stock.description like 'volleyball%';
  </code></pre>
  
  <p>The result is: </p>
  
  <p><img src="https://i.stack.imgur.com/L8W0o.jpg" alt="Result of Query"></p>
  
  <p>But I'm trying to get no repeating numbers on the <code>CUSTOMER_NUM</code> column.</p>
  
  <p>Thank you..</p>