title: if field equal by a value create new column in sql
body: <p>I have this table:</p>
  
  <pre><code>persnid  |  elemntref |   val
     100   |     1      |   5000
     100   |     2      |   2500
     100   |     3      |   3100
  </code></pre>
  
  <p>I want use the following conditions:</p>
  
  <pre><code>IF elemntref = 1 THEN create new column that name is 'pay'
  IF elemntref = 2 THEN create new column that name is 'pay2'
  IF elemntref = 3 THEN create new column that name is 'pay3'
  </code></pre>
  
  <p>table after run query:</p>
  
  <pre><code>   persnid  |  Pay   |   Pay2  |    pay3    
       100    | 5000   |   2500  |    3100
  </code></pre>