How to use IF ELSE condition for SQL in Netezza
<p>I want execute certain set of SQL statements based on parameters passed on from json and they all should be in single SQL.</p>

<p>I have 3 conditions namely </p>

<p><strong>1. Give
2. Take
3. Both</strong></p>

<p>Now in Netezza SQL,</p>

<p>I would like to have something as below:</p>

<pre><code>if %input = 'Give'
   set of give sql statements
else if %input = 'Take'
    set of take sql statements
else
    set of both sql statements.
</code></pre>

<p>After searching I found below links,but not sure if this is possible in Netezza.</p>

<p><a href="https://stackoverflow.com/questions/15085990/can-you-have-if-then-else-logic-in-sql">Can you have if-then-else logic in SQL?</a></p>

<p><a href="https://stackoverflow.com/questions/63447/how-to-perform-an-if-then-in-an-sql-select">How do I perform an IF...THEN in an SQL SELECT?</a></p>

<p>Can anyone please guide me?</p>

<p>I am new to Netezza db</p>

<p>Thanks
Maddy    </p>