title: combining two select queries from the same table
body: <p>I need to do something like this:</p>
  
  <pre><code>id  tag  status user   trial   Value (other columns)... 
  1   A    Pass   peter  first   0
  2   A    Pass   peter  second  1
  3   A    Fail   peter  third   3
  4   B    Pass   peter  first   4
  5   B    Pass   peter  second  5
  6   B    Pass   peter  third   6
  </code></pre>
  
  <p>select the rows that tag equal A and status equal to Pass  and find the same  value for other tag ex:B</p>
  
  <pre><code>id  tag  status user   trial   Value_tag_A  Value_tag_B  (other columns)... 
  1   A    Pass   peter  first   O            4
  2   A    Pass   peter  second  1            5
  </code></pre>
  
  <p>I can do some processing using php to get this result, but i'm wondering if i can do it directly using sql</p>
  
  <p>I've tried numerous variations and can't seem to get close  to the result.</p>
  
  <p>Solution: <a href="http://sqlfiddle.com/#!9/e9068d/17" rel="nofollow noreferrer">http://sqlfiddle.com/#!9/e9068d/17</a></p>