title: SQL Server, Select statement inside a 'case'
body: <p>Can anyone help me with the right syntax in SQL Server, I have something that looks like this inside a larger query</p>
  
  <pre><code>VSCS.ISCOTEACH,
  VSCS.NoMARKS,
  CASE (SELECT COUNT(*) FROM tbl_CoTeacher COTH WHERE    COTH.CLAS_METG_TIME_PK=VSCS.CLAS_METG_TIME_PK
          AND ISNULL(COTH.DELT_FLAG,0)=0) &gt; 0 THEN 1 ELSE 0 END AS HASCOTEACH),
  </code></pre>
  
  <p>The third line on is not correct of course, pretty much I want a column called <code>HASCOTEACH</code> to contain a 1 if the query  <code>SELECT COUNT(*) FROM tbl_CoTeacher COTH WHERE COTH.CLAS_METG_TIME_PK=VSCS.CLAS_METG_TIME_PK AND ISNULL(COTH.DELT_FLAG,0)=0</code> returns a value greater than 1, 0 otherwise.</p>