title: SQL Server - Select Specific Rows
body: <p>I have a table with data:</p>
  
  <pre><code>id  a_no  accountname
  1    NULL   ac1  
  1    234    ac2
  1    567    ac3
  2    NULL   ac4
  </code></pre>
  
  <p>I want to select row with the following criteria:</p>
  
  <ol>
  <li>if same id exist in more than 1 row, then remove the row with <code>a_no=NULL</code></li>
  <li>if id exist in 1 row only, keep that row unchanged</li>
  </ol>
  
  <p>So that the resulting rows should be</p>
  
  <pre><code>id  a_no  accountname
  1    234    ac2
  1    567    ac3
  2    NULL   ac4
  </code></pre>
  
  <p>How to write the T-SQL query?  Thanks.</p>