title: Multiple Table MySQL Join where i wish to join 1 particular table twice
body: <p>I have the following tables in my database that records user errors as a log so i can see who has made errors and at what time.</p>
  
  <p>log, users, errortype and timeperiod.<BR>
  <BR>
  Users contains,<BR>
  <BR>
  id|name <BR>
  1  David <BR>
  2  Mark<BR>
  3  Darren<BR></p>
  
  <p>errortype contains<BR>
  id | typeoferror<BR>
  1    error type 1<BR>
  2    error type 2<BR>
  3    errortype 3<BR></p>
  
  <p>timeperiod contains<BR>
  id | period<BR>
  1     7am-11am<BR>
  2     11am - 3pm<BR>
  3     3pm - 7pm<BR>
  4     7pm-11pm<BR></p>
  
  <p>and log contains</p>
  
  <p>id | user | date | time | staff | typeofmiss | timeperiod | dateoferror  | notes<BR>
  1  |  1   |1/1/15|11:23 |   2   |     2      |       3    |        1/1/15| blah<BR></p>
  
  <p>I would like the user column and the staff column both to link to the users table and the typeofmiss column to link to the errortype column and the timeperiod column to link to the timeperiod table so that when i have run a query it would return:</p>
  
  <p>1 - David - 1/1/15 - 11:23 - Mark - errortype 2 - 3pm-11pm - 1/1/15 - blah</p>
  
  <p>I have managed to get a query partly working, but i can't get the link the data from the users table twice i.e. for the user column and staff column, it returns the same name for both columns.
  Is there a way to get this to workor do i have to get  the data out and then change the numbers to the names using php or something?</p>
  
  <p>Thanks</p>