title: top 1 case in select statement on TSQL
body: <p>I am having problem on this query. How can I fix this:</p>
  
  <pre><code>select (select case top 1 STATUS 
         when 'Inprocess' then 'Processing' 
         when 'Inworkbin' then 'Waiting In Draft' 
         end 
      from ICS_EMAIL_CONNECTIONS_TRX A    
      where A.SESSIONID = B.SESSIONID 
      and STATUS &lt;&gt; 'Completed'
      order by A.CREATE_DATE desc) as LAST_STATUS 
  </code></pre>
  
  <p>I am getting this error:</p>
  
  <p>Incorrect syntax near the keyword 'top'.</p>
  
  <p>Any suggestions?</p>