title: Changing phone number with contact name
body: <p>I have a table for contacts like</p>
  
  <pre><code>Contacts
  number (Primary key)
  name   (name of the contact)
  
  Messages
  id (primary key)
  number (reciever or sender's phone number)
  type (sent or recieved)
  text (message body)
  date (timestamp)
  </code></pre>
  
  <p>What I want is, when I query the messages, and group them by phone number to make a conversation, i would like to change the phone number in the Messages table to change with the name of the contact in contacts table if present, if not present leave the phone number as a phone number as there are unknown numbers who can text too. PS I have googled a lot to find a solution but didn't find one.</p>
  
  <p>For example, </p>
  
  <pre><code>Contacts table contain
   id     name
   1       a
   2       b
  
  Messages Contain
   id   number  type      text   date
   1      1       sent    haha   123456
   2      3      recieved  hi    123459
  </code></pre>
  
  <p>Now result should be</p>
  
  <pre><code>   number    type       text      date
       a       sent       haha     123456
       3       received   hi       123459
  </code></pre>