我无法理解这个SQL。我有这3张桌子(见下图)。我需要找到一种方法来提取人的姓名和婚姻状况。我知道我需要2个联接,但我无法让它工作。
John Married Mary Widow
person_per
per_ID per_FirstName 1 John 2 Mary
person_custom
per_ID status_code 1 2 2 4
list_lst
status_code ??? 1 Married 2 Single 3 Divorced 4 Widow
答案 0 :(得分:3)
select per_FirstName, l.[status] /* you didn't put a name for that column */
from person_per p
inner join person_custom c on c.per_ID = p.per_ID
inner join list_lst l on l.status_code = c.status_code