title: Link one item to other item in same table
body: <p>I searched a lot but found nothing. </p>
  
  <p>My scenario is: </p>
  
  <p>I have database with two tables <code>table_item</code> and <code>table_item_linked</code>. <code>table_item</code> has many items. User will come and add item(s). Later other user come and <code>link</code> one item with other item(s) via a form with two <code>dropdown</code>.</p>
  
  <p>What I did so far is: </p>
  
  <p><strong>Structure of <code>table_item</code>:</strong></p>
  
  <pre><code>+-------------------+
  | table_item        |
  +-------------------+
  | item_id (Primary) |
  | others            |
  | ....              |
  | ....              |
  | ....              |
  +-------------------+
  </code></pre>
  
  <p><strong>Structure of <code>table_item_linked</code>:</strong></p>
  
  <pre><code>+---------------------+
  | table_item_linked   |
  +---------------------+
  | linked_id           | (Primary)
  | item_id             | (Foreign key referencing -&gt; item_id of table_item) 
  | linked_items        | (here I need to store ids of linked items)    
  | linked_by           | (referencing to user_id of user_table)           
  | linked_timestamp    | (timestamp) 
  +---------------------+
  </code></pre>
  
  <p>If I have items in <code>table_item</code> like: 
  <code>A</code> <code>B</code> <code>C</code> <code>D</code> <code>E</code> <code>F</code> <code>G</code> <code>H</code></p>
  
  <p>When I link <code>D</code> with <code>G</code></p>
  
  <p>I can successfully fetch <code>G</code> when I am fetching <code>D</code> or vice versa. But problem came when I</p>
  
  <p>Link <code>H</code> with <code>G</code></p>
  
  <p>So I must fetch <code>D</code> <code>H</code> while fetching <code>G</code>.</p>
  
  <p>(<code>D</code> <code>H</code> <code>G</code> are linked in all means and upon fetching one, the remaining two must be attached and fetched)</p>
  
  <p>It is like a multiple relation (Many to Many relationship). </p>
  
  <p>Guys I know there must be professional way to do it. I will like to have any guidance. I can even change my database structure. </p>
  
  <p><strong>PS:</strong> 
  Please don't suggest to add <code>#tag</code> as one item is exactly similar to the other linked. </p>
  
  <h2><strong>UPDATES</strong></h2>
  
  <p>Frontend looks like this. If I intend to link two records I will have two <code>dropdowns</code> as shown:
  <a href="https://i.stack.imgur.com/UcYG7.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/UcYG7.jpg" alt="Two dropdowns for linking records with one another"></a></p>
  
  <p>And If I check details of record <code>A</code> 
  <a href="https://i.stack.imgur.com/k6jFi.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/k6jFi.jpg" alt="Record A Details"></a></p>
  
  <p>And If I check details of record <code>B</code> 
  <a href="https://i.stack.imgur.com/hY4hz.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/hY4hz.jpg" alt="Record B Details"></a></p>
  
  <p>And If I check details of record <code>C</code> 
  <a href="https://i.stack.imgur.com/u86Jl.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/u86Jl.jpg" alt="Record C Details"></a></p>