0

我想加入三张桌子

  1. 患者数据 - (p.name)
  2. 雇主数据 - (e.name, e.city, e.stateAB)
  3. list_option_data - (l.state)

patient_data并且employer_data有共同领域pid
employer_data和共同list_option_data领域stateAB

所以我想显示p.name, e.name, e.city, l.state

select
    p.name,
    e.name,
    e.city,
    l.state
from patient_data as p
inner join
 /*
    this part i need to know how to join these...
 */
4

1 回答 1

0

您编写的代码就像您解释的那样:

select
    p.name,
    e.name,
    e.city,
    l.state
from patient_data p
join employer_data e on e.pid = p.pid
join list_option_data l on l.stateAB = e.stateAB

注意innerofinner join是多余的——默认的连接类型是inner

于 2012-08-06T13:37:06.213 回答