title: SQL Query: joining two fields from two separate rows
body: <p>I have the following two tables:</p>
  
  <pre><code>USER
  FID  UID     VALUE
  4    3       John
  3    3    Doe
  4    4       Jack
  3    4       Russel
  </code></pre>
  
  <p>Should be fairly clear that FID 3 = Surname, and FID 4 = Name.    </p>
  
  <pre><code>DATEDATA
  UID  DATE  
  3    1234
  4    4321
  </code></pre>
  
  <p>I want to join these two tables, so that I end up with something like this:</p>
  
  <pre><code>UID  DATE  NAME   SURNAME
  3    1234  John   Doe
  4    4321  Jack   Russel
  </code></pre>
  
  <p>or... alternatively...</p>
  
  <pre><code>UID  DATE  FULLNAME
  3    1234  John Doe
  4    4321  Jack Russel
  </code></pre>
  
  <p>Any SQL gurus out there?</p>
  
  <p>This is what I have so far:</p>
  
  <pre><code>SELECT UID, DATE, VALUE 
      from DATEDATA as D 
      left join USER as U 
      on U.uid = D.uid where fid = 3 OR fid = 4
  </code></pre>
  
  <p>But that gives me this:</p>
  
  <pre><code>UID  DATE  VALUE
  3    1234  Doe
  3    1234  John
  4    4321  Russel
  4    4321  Jack
  </code></pre>
  
  <p>Anyone?</p>