說我有這些表:設置MySQL列名
people(id, name),
cars(person_id, car)
與此查詢:
SELECT c.car
FROM people as p, cars as c
WHERE c.person_id = p.id
AND p.id = 3
我想c.car
列從該name
領域採取它的名字people
表,像這樣(無效SQL,只是爲了說明):
SELECT c.car AS(SELECT name FROM people WHERE id = 3)
我該怎麼做?