title: SQL How to add if else conditions in sql
body: <p>Table A consists of firstname, secondname, lastname, msisdn, registrationdate.. table b have firstname, secondname, lastname, msisdn, registrationdate and a few other columns - but i only want to consider these mentioned 5 columns.
  I have something like this</p>
  
  <pre><code>SELECT SELECT A.MSISDN,A.FIRSTNAME,A.SECONDNAME,A.LASTNAME,A.REGDATE, B.MSISDN,B.FIRSTNAME,B.SECONDNAME,B.LASTNAME,B.REGDATE 
  FROM TABLE1 A
  INNER JOIN TABLE2 B ON A.MSISDN = B.MSISDN
  WHERE A.FIRSTNAME != B.FIRSTNAME 
  OR A.LASTNAME != B.LASTNAME
  </code></pre>
  
  <p>Previously i only considered firstname, lastname from table A and checked for mismatch in table B, but i'm getting thousands of records as results and i wanted narrow down the search.</p>
  
  <p>How do i include an if else case here so that </p>
  
  <pre><code>if a.firstname == b.firstname &amp;&amp; a.secondname == b.lastname - Ignore this record.
  
  if a.firstname == b.firstname &amp;&amp; a.lastname == b.lastname - Ignore this record.
  
  if a.firstname == b.firstname &amp;&amp; a.lastname == b.secondname- Ignore this record.
  
  if a.firstname not equal to b.firstname - show this record as result
  
  if a.firstname == b.firstname &amp;&amp; a.secondname not equal to b.lastname - show this record as result
  </code></pre>
  
  <p>else show all the records as results that doesn't fall into any of these above cases. Also if it is possible, please include a solution to ignore capital letters and small letters while checking for mismatches.</p>
  
  <p><a href="https://i.stack.imgur.com/8Q6UC.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/8Q6UC.jpg" alt="Please find the sample data here"></a>
  the problem here is, after executing the query from @sagi, in the results i'm getting the rows which has perfect match between first,second and lastnames but has a different registration date - as we are not considering registration date in the query, will it impact the results?</p>