mardi 31 mars 2015

Selecting multiple tables in SQL

Im new working with SQL. Actually I am working with SQLite and in my DB I have multiple tables. In my case I have 2 tables which should be shown as options. One is shown but the other one I don't know how to access it.


This is what I have now but I want to add another one. So instead "clients" will be "types"


How can I access the other table in the same time?



$sql = "SELECT 'i'.*,
't'.'name' AS 'client_name'
FROM 'items' 'i'
JOIN 'clients' 't'
ON 't'.'id' = 'i'.'client'
ORDER BY 'i'.'date' ASC";
$sql = "SELECT *
FROM 'clients'
ORDER BY 'id'";

Aucun commentaire:

Enregistrer un commentaire