jeudi 26 mars 2015

Access all rows in table that is linked to another table

I have 2 tables in SQLite. One is called contacts and the other is phoneNumbers. phoneNumbers is linked to contacts with integer references. Here is the tables:



CREATE TABLE contacts(
id INTEGER PRIMARY KEY,
name text
);

CREATE TABLE phoneNumbers(
id INTEGER PRIMARY KEY,
homePhone text,
contact_id INTEGER REFERENCES contacts(id)
);


My question is, how can I access all homePhone that is linked to contacts (id) 1?


Hope this is clear. If you have any questions, feel free to ask in the comments.


Aucun commentaire:

Enregistrer un commentaire