title: mysql update query to set field with id's of another table
body: <p>I have 3 tables in database </p>
  
  <p><strong>1) videos.</strong></p>
  
  <pre><code>id    name
  1     one
  2     two
  3     three
  </code></pre>
  
  <p><strong>2) session_has_video.</strong></p>
  
  <pre><code>session_id    video_id
  1             1
  1             3
  </code></pre>
  
  <p><strong>3) channel_has_session.</strong></p>
  
  <pre><code>channel_id    session_id    videos
  1             1
  </code></pre>
  
  <p>I want to update <code>channel_has_session.videos</code> with all the <code>video.id</code> where <code>video.id</code> is in <code>session.session_id</code>. It means it should be <code>1,3</code></p>
  
  <p>So, updated table should look like this</p>
  
  <p><strong>channel_has_session.</strong></p>
  
  <pre><code>channel_id    session_id    videos
  1             1             1,3
  </code></pre>
  
  <p>i tried this query, but obvious not working.</p>
  
  <pre><code>update channel_has_session set videos = ( SELECT video_id FROM session_has_video where session_id=1 ) where session_id=1 and channel_id=1
  </code></pre>
  
  <p>Is there any easiest way to do like this in MySQL?</p>