title: SQL: Don't show duplicates
body: <p>I want to <em>not</em> show duplicate rows in output for the sql below and so I have 'distinct' in there, but this doesn't work. I get output like:</p>
  
  <pre><code>PermitNumber PermitName CreatedOn  
  111          ABCD       1/2/2011  
  111          ABCD       3/4/2012  
  222          DFES       3/6/2000  
  </code></pre>
  
  <p>and I want only one row with 111 but I get more than 1 row because 111 has more than one modification, but I don't care if it has 1 or 1000.</p>
  
  <pre><code>select  distinct (dbo.PermitNumber(mp.PermitId)), 
          dbo.PermitName(mp.PermitId),
      mod.[CreatedOn] as [CreatedOn]
  from    tblPermit mp, dbo.[tblModification] mod
  where mod.PermitId = mp.PermitId
  order by 1
  </code></pre>
  
  <p>Using SQL Server</p>