title: SQL - Create "virtual" column based on data from other columns
body: <p>I have a some issues with a SQL query I'm working on, I'm sorry that I don't have any work-in-progress to show because nothing that I have tried until now have worked out too well, so I am hoping that someone will be able to point me in the right direction.</p>
  
  <p><strong>Tables:</strong></p>
  
  <p>Computers:</p>
  
  <pre><code>[SN][PN][ComputerName][Model][OS][Architecture][RAM][CPU]
  </code></pre>
  
  <p>Logons: </p>
  
  <pre><code>[SN][Username][Timestamp]
  </code></pre>
  
  <p><strong>Info:</strong></p>
  
  <p>It works this way, every time a user logs on to a computer the computer info gets updated to the computer table and the username and timestamp gets inserted to the logons table.</p>
  
  <p><strong>Result</strong></p>
  
  <p>The result I am trying to acheive is the following:</p>
  
  <pre><code>[SN][PN][ComputerName][Model][OS][Architecture][RAM][CPU]**[Primary User]**
  </code></pre>
  
  <p>It should be only one row for each computer</p>
  
  <p>The Primary User field should be based from the 5 latest logons and being the username with the most recurrences in those 5.</p>
  
  <p>So I think that wraps It up, I hope someone here is able to at least point me in the right direction as every result google have to offer now show up as red.</p>