Предположим, у меня есть две таблицы
Код: Выделить всё
|TABLE_A | |TABLE_B |
|id |name | |id |foreign_id |subjects |
|1 |Dave | |1 |1 |math |
|2 |Steve | |2 |1 |science |
|3 |Peeve | |3 |3 |english |
Код: Выделить всё
SELECT u.id, u.name, t.subjects
FROM TABLE_A u
INNER JOIN TABLE_B t ON u.id = t.foreign_id
Код: Выделить всё
|TABLE_? |
|id |name |subjects |
|1 |Dave |math |
|1 |Dave |science |
|3 |Peeve |english |
Подробнее здесь: https://stackoverflow.com/questions/493 ... -in-sqlite