title: MYSQL GROUP BY multiple different values with specific column
body: <p>MYSQL Structure:</p>
  
  <pre><code> ID | USERID | FRIENDID | Type
  -------------------------------
   1  |   10   |    20    | Gold
   2  |   20   |    10    | Gold
  
   3  |   30   |    40    | Silver
   4  |   40   |    30    | Silver
  
   5  |   50   |    60    | Gold
   6  |   60   |    50    | Gold
  
   7  |   70   |    80    | Bronze
   8  |   80   |    70    | Bronze
  
   9  |   90   |   100    | Bronze
  10  |  100   |    90    | Bronze
  </code></pre>
  
  <p>What i want is GROUP (ID 1 &amp; ID 2) and (ID 5 &amp; ID 6) because they are "gold" type, <strong>NOT GROUP BY TYPE</strong>. </p>
  
  <p>Return Results:</p>
  
  <pre><code> 1. 10 &amp; 20, type:gold. (GROUP)
  
   3. 30 &amp; 40, type:silver.
   4. 40 &amp; 30, type:silver.
  
   5. 50 &amp; 60, type:gold. (GROUP)
  
   7. 70 &amp; 80, type:bronze.
   8. 80 &amp; 70, type:bronze.
  
   9. 90 &amp; 100, type:bronze.
  10. 100 &amp; 90, type:bronze.
  </code></pre>
  
  <p>How to do that with php query?</p>
  
  <p>Demo: <a href="http://sqlfiddle.com/#!2/13bd3/1" rel="nofollow">http://sqlfiddle.com/#!2/13bd3/1</a></p>