title: How to return null for certain values mysql
body: <p>I am writing an outer join in sql to search a few tables and the code basically works except that I need it to return only the persons twitter link so if they have another social media listed or no social media at all it should return null but right now it returns all the social media links.  I tried using a where statement to see if smtype equaled twitter but that just returned the ones the had twitter and I need it to return all of them and just output null if it is something other than twitter. Plus it only needs to output each name once.</p>
  
  <pre><code>select fname, lname, rname, advisor_name, smaddr 
  from PERSON 
  join ADVISOR on PERSON.idnum = ADVISOR.student 
  left join DIGITAL on ADVISOR.student = DIGITAL.idnum 
  union 
  select fname,lname, rname, advisor_name, smaddr 
  from PERSON 
  left join ADVISOR on PERSON.idnum = ADVISOR.student 
  left join DIGITAL on ADVISOR.student = DIGITAL.idnum;
  </code></pre>
  
  <p>DIGITAL table where social media info is stored:</p>
  
  <pre><code>+-------+----------+------------------------------+
  | idnum | smtype   | smaddr                       |
  +-------+----------+------------------------------+
  | 22222 | facebook | facebook.com/clemons.timothy |
  | 40256 | facebook | facebook.com/south.william   |
  | 68123 | facebook | facebook.com/smith.terry     |
  | 22222 | twitter  | twitter.com/clemons.timothy  |
  | 40256 | twitter  | twitter.com/south.william    |
  | 68123 | twitter  | twitter.com/smith.terry      |
  +-------+----------+------------------------------+
  </code></pre>
  
  <p>Current Output:</p>
  
  <pre><code>+----------+---------+-------------------------+---------------+----------------------------+
  | fname    | lname   | rname                   | advisor_name  | smaddr                     |
  +----------+---------+-------------------------+---------------+----------------------------+
  | William  | South   | south.william@uky.edu   | Abby Tanner   | facebook.com/south.william |
  | William  | South   | south.william@uky.edu   | Abby Tanner   | twitter.com/south.william  |
  | Terry    | Smith   | smith.terry@uky.edu     | Nicole Taylor | facebook.com/smith.terry   |
  | Terry    | Smith   | smith.terry@uky.edu     | Nicole Taylor | twitter.com/smith.terry    |
  | Timothy  | Clemens | clemens.timothy@uky.edu | NULL          | NULL                       |
  | Dan      | North   | north.dan@uky.edu       | NULL          | NULL                       |
  | Courtney | Cox     | NULL                    | NULL          | NULL                       |
  +----------+---------+-------------------------+---------------+----------------------------+
  </code></pre>