title: Convert rows to a table
body: <p>I need to create a table (possibly a view) that relates two tables, one table of configs with a results table. The problem is that it's necessary transform a simple row in the results table in multiple rows of the configs table.</p>
  
  <p>I will give you an example of what I need:</p>
  
  <p><strong>Configs Table:</strong> primary key = (id_file,cpattr)</p>
  
  <pre><code>id_file     cpattr      type
  ------------------------------------
  f01         dim01       merchant_id
  f01         dim02       card_number
  f01         dim03       trans_code
  f02         dim01       card_number
  f02         dim02       amount
  </code></pre>
  
  <p><strong>Results Table</strong></p>
  
  <pre><code>id_file dim01   dim02   dim03
  -------------------------------------------------------
  f01      01      88      015
  f02      99     0.78    null
  </code></pre>
  
  <p>And I want to get a table(View) with the following <strong>output</strong>:</p>
  
  <pre><code>id_file type            data
  --------------------------------------------------
  f01     merchant_id     01
  f01     card_number     88
  f01     trans_code      015
  f02     card_numer      99
  f02     amount          0.78 
  </code></pre>
  
  <p>I'm not seeing a way of do that without using dynamic sql, but I'm trying to avoid it. Hope you can help me.</p>
  
  <p>Thanks in advance.</p>