title: How to create subquery with distinct in Oracle SQL
body: <p>I have the following two ORACLE SQL queries which work well:</p>
  
  <pre><code>SELECT COUNT(SEG_ID) INTO totalUniqueSegments FROM CAR_RENTAL_SERVICES;
  
  SELECT DISTINCT SEG_ID FROM CAR_RENTAL_SERVICES;
  </code></pre>
  
  <p>But I need to combine them. I'd like my count to consider only unique seg_id.</p>
  
  <p>This is what I've tried:</p>
  
  <pre><code>SELECT COUNT(SEG_ID)INTO totalUniqueSegments FROM CAR_RENTAL_SERVICES WHERE SEG_ID IN (SELECT DISTINCT SEG_ID FROM CAR_RENTAL_SERVICES);
  </code></pre>
  
  <p>But I'm getting the error 'missing expression'. It should be fairly simple but I'm not very experienced. Thanks.</p>
  
  <p>EDIT: this <code>COUNT(SEG_ID)INTO</code> was changed to this <code>COUNT(SEG_ID) INTO</code> (with space).
  Now the error is 'missing expression'</p>