title: How to get distinct records in sqlserver
body: <pre><code>FUNDFAMILY_ID    FUND_NAME                REPORTSECTION_ID           
  --------------------------------------------------------------
  172295295    VANGUARD GROWTH FUND (Retail)  126345
  172295295    VANGUARD GROWTH FUND (Retail)  126354
  --------------------------------------------------------------
  </code></pre>
  
  <p>But i need to get the results like below:</p>
  
  <pre><code>FUNDFAMILY_ID     FUND_NAME                   REPORTSECTION_ID
  --------------------------------------------------------------
  172295295   VANGUARD GROWTH FUND (Retail)   126345
  </code></pre>
  
  <p>Inside a stored procedure i have a query like below which gives duplicate rows</p>
  
  <pre><code>    INSERT INTO #TABLE_REPORTSECTIONDATA (FUND_NAME, FUNDFAMILY_ID, REPORTSECTION_ID)
  
                  SELECT DISTINCT @FUNDNAME_TEMP , @FUNDID_TEMP, EntryPointViewsId
                  FROM EntryPointViews EPV
                  ORDER BY EntryPointViewsId
  </code></pre>
  
  <p>DISTINCT keyword is not giving me the correct results.please suggest</p>