title: PHP/MYSQL Join multiple tables
body: <p>Fields from table <strong>TICKETS</strong>:</p>
  <pre><code>ID TICKETID CUSTOMER
  234   29      9798797
  235   76      7887878
  </code></pre>
  <p>Fields from table <strong>RECEPTS</strong>:</p>
  <pre><code>ID   DATENEW    TOTAL
  234 2012-12-03   22.57
  235 2012-12-03   33.98
  </code></pre>
  <p>Fields from table <strong>PAYMENTS</strong>:</p>
  <pre><code>RECEIPT   PAYMENT
  234       cash
  235       debt
  </code></pre>
  <p>Fields from table <strong>CUSTOMERS</strong>:</p>
  <pre><code>ID            NAME
  9798797       John
  7887878       Helen
  </code></pre>
  <p>The relation between tables is very easy to understand: <code>TICKETS.CUSTOMER=CUSTOMERS.ID;</code> <code>PAYMENTS.RECEIPT=RECEIPTS.ID=TICKETS.ID</code></p>
  <p>The Final Result I would like to achive to have:</p>
  <pre><code>TICKETID DATENEW      NAME    PAYMENT TOTAL
  29       2012-12-03   John     cash   22.57
  76       2012-12-03   Helen    debt   33.98
  </code></pre>
  <p>I tried to do something like this but it wrong somewhere:</p>
  <pre><code>Select TICKETS.TICKETID, RECEIPTS.DATENEW, PAYMENTS.TOTAL,  CUSTOMERS.NAME, PAYMENTS.PAYMENT FROM PEOPLE, RECEIPTS 
  INNER JOIN TICKETS ON RECEIPTS.ID = TICKETS.ID
  INNER JOIN CUSTOMERS ON TICKETS.CUSTOMER = CUSTOMERS.ID
  ORDER BY RECEIPTS.DATENEW
  </code></pre>