title: How to update a column using group by in SQL
body: <p>I have two tables and I want to update one row from <code>GROUP BY</code> data</p>
  
  <p>This is my code:</p>
  
  <p><em><strong>2nd code:</em></strong></p>
  
  <pre><code>UPDATE [TABLE].[dbo].[Movies]
  SET [NumFrames] = 
     (SELECT COUNT(ImageURL) as "Count"
      FROM [TABLE].[dbo].[Frames]
      GROUP BY Movie_Id)
  GO
  </code></pre>
  
  <p><em><strong>1st code:</em></strong></p>
  
  <pre><code>(SELECT COUNT(ImageURL) as "Count"
  FROM [TABLE].[dbo].[Frames]
  GROUP BY Movie_Id
  </code></pre>
  
  <p>1st code give me a row with numbers</p>
  
  <pre><code>Count
   12
    6
   10
   10
   10
  </code></pre>
  
  <p>I want to insert it into <code>Movies.NumFrames</code></p>
  
  <p>2nd code give me an Error</p>
  
  <blockquote>
    <p>Msg 512, Level 16, State 1, Line 1<br>
    Subquery returned more than 1
    value. This is not permitted when the subquery follows =,   !=, &lt;, &lt;=
    , >, >= or when the subquery is used as an expression.</p>
  </blockquote>
  
  <p>Please help</p>
  
  <p>I'm sure it's simple</p>