Duplicate values from an junction table
<p>So have have three tables.</p>

<p><code>Users(uid,username,email);</code></p>

<p><code>Studies(sid, studyname);</code></p>

<p><code>Users_Studies(uid,sid);</code></p>

<p>Now lets say the many-many junction table is populated like:
<code>User_studies(uid,sid)
(1,1)
(1,2)
(1,5)
(3,1)
(2,1)</code></p>

<p>I create an user that gets uid=4.
And i want that user to get the same connections as uid=1
meaning it should look like this:
<code>User_studies(uid,sid)
(1,1)
(1,2)
(1,5)
(3,1)
(2,1)
(4,1)
(4,2)
(4,5)</code></p>

<p>Whats the best way of handling this? looked into stored procedures and while loop without quite figuring it out :) Is there a simple duplicate command? or could someone please guide me in the best way to do this :)</p>