如何更改全名的doc-id?
select w.id,w.doc,w.org
from workplaces w join
orgs o
on o.id=w.org
--where o.active=1 and o.cst='NY' and w.active=1 and w.cst='NY'(table have -
history, and active=1-it is actual record)
order by w.org
答案 0 :(得分:0)
检查此。您需要为JOIN
表添加另一个doctors
:
SELECT
o.name OrgName
w.id
,d.name_f +' '+d.name_s DoctorFullName
,d.name_p
,w.org
FROM workplaces w
JOIN orgs o ON o.id = w.org
JOIN doctors d ON d.id = w.doc
order by w.org