title: COALESCE() to get Not null as well as NULL Values
body: <p>I have my Mysql Query as :</p>
  
  <pre><code>select RecordID,ID,Name,Description,RecordDateTimeUTC,Location from
  eemployee where RecordID like ? and(isNull(RecordDateTimeUTC) OR RecordDateTimeUTC=  CASE  WHEN COALESCE(?,'') = ''  THEN RecordDateTimeUTC  ELSE ?  END)........
  </code></pre>
  
  <p>Now my query There are lott of fields(? --> this is where i am putting my data for filter perpose) upon which user can query so i am using <strong>coalesce</strong> but the disadvantage of using <strong>coalesce</strong> is <strong>it doesn't give me null values when i want to get all data present in employee table</strong> , so to get null values i have used <strong>isNull</strong>  function.</p>
  
  <p>Now i am testing the above query for two use cases</p>
  
  <p>1-->User can pass percentage in RecordID:-In this case he should get all data either null as well as not null values :</p>
  
  <pre><code>    select RecordID,ID,Name,Description,RecordDateTimeUTC,Location from
          eemployee where RecordID like '%' 
  and(isNull(RecordDateTimeUTC) OR RecordDateTimeUTC=  CASE  WHEN COALESCE('','') = ''  THEN RecordDateTimeUTC  ELSE ''  END)
  </code></pre>
  
  <p>2-->User can filter data based on RecordDateTimeUTC:- If user passes this parameter then he should get all not null data satisfying the above filteration.:-</p>
  
  <pre><code>select RecordID,ID,Name,Description,RecordDateTimeUTC,Location from
          eemployee where RecordID like '%' and(isNull(RecordDateTimeUTC) OR RecordDateTimeUTC=  CASE  WHEN COALESCE('2012-07-09 11:11:00','') = ''  THEN RecordDateTimeUTC  ELSE '2012-07-09 11:11:00'  END)
  </code></pre>
  
  <p>For the first use case it is working fine but for the second use case it is giving me filtered data as well as null Data</p>
  
  <p><strong>So what should be my query so that both my use cases are supported by the above single query.
  I am using MYSQl Query Browser to test my query</strong></p>
  
  <p>Thanks in advance</p>