Not able to use a select query to get number of days in DATEADD function
<p>I have a table, Table1, in the following format:</p>

<pre><code>Country    No_Of_Days
  XX          5
  YY          10
</code></pre>

<p>And I need to update  End_Date column in another table, Table2, which has a Start_Date  by adding the days in above mentioned table to Start_date:</p>

<pre><code>Country     Start_Date      End_Date    Calc_Manual_Flag
  XX        25-Dec-16       30-Dec-16        CALC
  YY        02-Jan-17       12-Jan-17        CALC  
</code></pre>

<p>I used the following query but it does not seem to work:</p>

<pre><code>UPDATE dbo.Table2
SET End_date = 
dateadd(
        day,
        (SELECT No_Of_Days FROM Table1 WHERE Table2.Country = Table1.Country),Start_Date),
    Calc_Manual_Flag = 'CALC'
WHERE Table2.End_Date IS NULL
AND Table2.Start_Date IS NOT NULL
</code></pre>

<p>But it does not seem to be working properly. The updates do not seem to be happening as expected. I am getting the following error message:</p>

<pre><code>Msg 512, Level 16, State 1, Line 1
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.
</code></pre>

<p>Kindly provide guidance on this.</p>