title: writing a query to to generate two records from one record based on some condition
body: <p>I have table with columns:</p>
  
  <ul>
  <li>flag1</li>
  <li>flag2</li>
  <li>flag1_column1</li>
  <li>flag1_column2</li>
  <li>flag1_column3</li>
  <li>flag2_column1</li>
  <li>flag2_column2</li>
  <li>flag2_column3 </li>
  </ul>
  
  <p>my requirement is:</p>
  
  <ul>
  <li><p>If both <code>flag1</code> and <code>flag2</code> have value true then in result I should get two records:</p>
  
  <ol>
  <li><code>flag1, flag1_column1, flag1_column2, flag1_column3</code></li>
  <li><code>flag2, flag2_column1, flag2_column2, flag2_column3</code></li>
  </ol></li>
  </ul>
  
  <p>my second requirement:</p>
  
  <p>If <code>flag1</code> is <code>null</code> or <code>0</code> then I should get only one record:</p>
  
  <pre><code>flag2 ,flag2_column1, flag2_column2, flag2_column3 
  </code></pre>
  
  <p>my third requirement:</p>
  
  <p>If <code>flag2</code> is <code>null</code> or <code>0</code> then I should get only one record:</p>
  
  <pre><code>flag1 , flag1_column1, flag1_column2, flag1_column3
  </code></pre>