title: Select count from subselect syntax
body: <p>I have two tables SurrogateKeys and SurrogateKeyRelatives.</p>
  
  <p>I will find out of there are records that satisfy a query joining both tables.</p>
  
  <p>I am playing with two options:</p>
  
  <pre><code>select count(*) from 
  (
      select top(1) sk.Username from SurrogateKeys as sk
  
      inner join SurrogateKeyRelatives as skr
      on sk.Id = skr.SurrKeyId
  
      where 
  
      sk.Username='John.Doe' and
      skr.SomeField = 1
  )
  </code></pre>
  
  <p>and </p>
  
  <pre><code>if exists(
      select top(1) sk.Username from SurrogateKeys as sk
  
      inner join SurrogateKeyRelatives as skr
      on sk.Id = skr.SurrKeyId
  
      where 
  
      sk.Username='John.Doe' and
      skr.SomeField = 1
     )
     begin
      select 1
     end
  else
      begin
        select 0
      end
  </code></pre>
  
  <p>Attempting option 1 gives me Incorrect Syntax near ')'.  What am I missing in the above query?</p>