title: SQL Server - Select statement with multiple conditions from other table
body: <p>I am trying to execute a SQL query in SSMS to return the row count for terminalID that exists in another table and also where the record is greater than 2015 but it throws me an error. Here is my query:</p>
  
  <pre><code>select count(*) 
  from AuditTerminal(nolock)
  where TerminalID in (Select TerminalID from Terminal)
    and (select * from Terminal where LastChangeDate &gt;= '2015-01-01')
  </code></pre>
  
  <p>Is there any way to put the last line so the condition succeeds?</p>
  
  <p>EDIT: what about this?</p>
  
  <pre><code>select * 
  from AuditTerminal(nolock)
  where TerminalID in (select TerminalID from Terminal)
    and exists (select * from Terminal where LastChangeDate &gt;= '2015-01-01')
  </code></pre>