title: Sql query problem while joining the query to another query
body: <p>I am running the below query in sql but it is giving the below error.</p>
  <blockquote>
  <p>Subquery returned more than 1 value. This is not permitted when the subquery follows =, !=, &lt;, &lt;= , &gt;, &gt;= or when the subquery is used as an expression.</p>
  </blockquote>
  <p>What I have tried :</p>
  <pre class="lang-sql prettyprint-override"><code>SELECT b.Service_Name,
         c.Service_Type,
         Application_No,
         Reg_No,
         Student_Name,
         (SELECT CONVERT(char(10),
                         dt + (SELECT COUNT(1)
                               FROM Holiday_list
                               WHERE Date_Fmt BETWEEN School_update AND dt),
                         103) AS cnt
          FROM (SELECT CASE WHEN Service_TypeID = '1' THEN (School_update + 30) ELSE (School_update + 5) END AS dt
                FROM Application_Status) a ) AS Nxt_date,
         DATEDIFF(DAY, School_update, GETDATE()) AS Day_Count,
         Created_Date,
         School_Code,
         CASE WHEN Payment_Status = 'Y' THEN 'PAID' WHEN Payment_Status = 'N' THEN 'NOT PAID' END AS Payment_Status
  FROM Application_Status a,
       MST_Service b,
       MST_ServiceType c,
       KSEEBMASTERS.dbo.MST_SCHOOL s,
       MST_Division d
  WHERE a.Service_ID = b.Service_ID
    AND s.SCM_SCHOOL_CODE COLLATE Latin1_General_CI_AI = a.School_Code
    AND s.DIST_CODE COLLATE Latin1_General_CI_AI = d.DistrictCode
    AND a.Service_TypeID = c.Type_ID
    AND d.DivisionCode = 'ED'
    AND Payment_Status = 'Y'
    AND school_status = 'Y'
    AND Div_Status = 'N';
  </code></pre>
  <p>But the problem is in the below query while joining the query to another query.</p>
  <pre class="lang-sql prettyprint-override"><code>SELECT CONVERT(char(10),
                 dt + (SELECT COUNT(*)
                       FROM Holiday_list
                       WHERE Date_Fmt BETWEEN School_update AND dt),
                 103) AS cnt
  FROM (SELECT CASE WHEN Service_TypeID = '1' THEN (School_update + 30) ELSE (School_update + 5) END AS dt,
               School_update
        FROM Application_Status) a;
  </code></pre>
  <p>Here Application_Status is sone table with Column name School_Update and Holiday_List is another table with column name Date_Fmt.</p>