我想在tour_customer,tour_provider,预订中检查ncarpk,如果有任何表有ncarpk = 7的记录,则显示结果。
select *
from tour_customer
Left Outer join tour_provider on tour_provider.nCarPk = '7'
Left Outer join reservation on reservation.nCarPk = '7'
where tour_customer.ncarpk = '7'
最佳答案
我会尝试
select *
from tour_customer
Left Outer join tour_provider on tour_provider.nCarPk =customer.ncarpk
Left Outer join reservation on reservation.nCarPk = customer.ncarpk
where tour_customer.ncarpk = '7'
这是进行联接的正常方法,您说出要在哪个字段上进行联接,然后添加where子句。