title: IF-THEN-ELSE statements in postgresql
body: <p>I'm looking to write a postgresql query to do the following :</p>
  
  <pre><code>if(field1 &gt; 0,  field2 / field1 , 0)
  </code></pre>
  
  <p>I've tried this query, but it's not working</p>
  
  <pre><code>if (field1 &gt; 0)
  then return field2 / field1 as field3
  else return 0 as field3
  </code></pre>
  
  <p>thank youu</p>