title: Conditional column for query based on other columns in MySQL
body: <p>I'm pretty sure I've seen this somewhere, but I can't find the right terminology so I'm having trouble...</p>
  
  <p>Let's say I have a table with user info (let's also assume that it was created by someone who gets paid more than me, so modifying the schema is not an option.) Among the various columns of user info are columns for DOB and job title. I want a query that, based on what is in those columns, will include an extra column called "Real_Title", for example:</p>
  
  <pre><code>User_id    Job_Title    DOB
    joe_1      manager    01/01/1950
    jim_1    associate    01/01/1970
   jill_1    associate    01/01/1985
   jane_1      manager    01/01/1975
  </code></pre>
  
  <p>query:</p>
  
  <pre><code>SELECT User_id, Real_Title FROM users
  IF (YEAR(DOB) &lt; 1980 AND Job_Title = "manager")
     {Real_Title = "Old Fart"}
  ELSE IF (YEAR(DOB) &lt; 1980 AND Job_Title = "associate")
     {Real_Title = "Old Timer"}
  ELSE IF (YEAR(DOB) &gt; 1980 AND Job_Title = "manager")
     {Real_Title = "Eager Beaver"}
  ELSE IF (YEAR(DOB) &gt; 1980 AND Job_Title = "associate")
     {Real_Title = "Slacker"}
  </code></pre>
  
  <p>I know the above is not only wrong but also coded really inefficient, but I wanted to get the idea across.</p>
  
  <p>Is there a way, without using joins, to populate a column based on information in one or more other columns in the same table?</p>
  
  <p>Currently I'm using something in the PHP script after the results are obtained to channel those results into the groups I want, but if it can be done in the query, that would make porting the query to other scripts and languages much easier.</p>
  
  <p>Thanks!</p>