title: how to transform vertical fields in a table to horizontal result by SQL
body: <p>I have a table like this:</p>
  
  <pre><code>create table t1 {
    person_id int,
    item_name varchar(30),
    item_value varchar(100)
  };
  </code></pre>
  
  <p>Suppose person_id+item_name is the composite key, now I have some data (5 records)  in table t1 as below:</p>
  
  <pre><code>person_id ====item_name ====== item_value
     1          'NAME'           'john'
     1          'GENDER'         'M'
     1          'DOB'            '1970/02/01'
     1          'M_PHONE'        '1234567890'
     1          'ADDRESS'        'Some Addresses unknown'
  </code></pre>
  
  <p>Now I want to use SQL (or combing store procedure/function or whatever) to query the above result (1 result set) become:</p>
  
  <pre><code>NAME==GENDER==DOB========M_PHONE=======ADDRESS===============
  1     M       1970/02/01 1234567890    Some Addresses unknown
  </code></pre>
  
  <p>How should I do ?
  Thank you for your help.</p>