title: An expression of non-boolean type specified in a context where a condition is expected, near ','
body: <p>I've reviewed other similar questions on this however I do not have a <code>Where</code> clause in my query which leaves me a little confused as to how to resolve it.</p>
  
  <pre><code>INSERT INTO #tmpCombined  
  SELECT A.Region  
      , 'MyLocation' AS 'Location'  
      , c.Id AS 'CompID'  
      , c.Name AS 'CompName'  
      , 'Cash' AS 'Context'  
      , isnull( sum( CASE WHEN T.TranAge &gt;= 0 and CASE WHEN T.TranAge &lt; 1 THEN 1 ELSE 0 END,0 )) AS 'ZeroDays0'  
      , isnull( sum( CASE WHEN T.TranAge &gt;= 1 and CASE WHEN T.TranAge &lt; 8 THEN 1 ELSE 0 END ), 0 ) AS '1to7Days'  
      , isnull( sum( CASE WHEN T.TranAge &gt;=  8 and CASE WHEN T.TranAge &lt; 16 THEN 1 ELSE 0 END ), 0 ) AS '8to15Days'  
      , isnull( sum( CASE WHEN T.TranAge &gt;=  16 and CASE WHEN T.TranAge &lt; 20 THEN 1 ELSE 0 END ), 0 ) AS '16to20Days'  
      , isnull( sum( CASE WHEN T.TranAge &gt;=  20 THEN 1 ELSE 0 END ), 0 ) AS '20DaysPlus'  
      , COUNT(1) AS 'Total'  
      , A.Level as 'Level'  
      , sum(T.USDDifference) AS 'USDRevaluation'  
      from MyLocation.dbo.Company C  
      inner join #tmpCashTBResults T on T.CompanyId = C.Id  
      inner join #tmpCashAccounts A on T.CompanyId = A.CompanyId  
      group by A.Region, C.Id, C.Name, A.Level  
  </code></pre>