select * from `appointments`
inner join `artists`
on `appointments`.`artist_id` = `artists`.`id`
inner join `artists`
on `appointments`.`client_id` = `artists`.`id`
我无法弄清楚这一点,我需要在同一个表上使用不同的参数与其他表的唯一ID进行两次联接。
答案 0 :(得分:1)
您需要表别名:
select *
from appointments ap inner join
artists aa
on ap.artist_id = aa.id inner join
artists ac
on ap.client_id = ac.id;