Join 4 tables with inner join
<p>I'm trying to write below query with INNER JOIN instead of AND</p>

<pre><code>select ph.name, ph.position, d.name, COUNT(app.appointmentId)
from physician ph, works_in w, appointment app, department d
where ph.eid = w.physician 
    and d.did = w.department
    and ph.eid = app.physician
group by ph.eid, ph.name, ph.position, d.name
</code></pre>

<p>.</p>

<p>I tried in this way, But It gets so many errors</p>

<pre><code>select ph.name, ph.position, d.name, COUNT(app.appointmentId)
from physician ph inner join works_in w
    on ph.eid = w.department,
    department d inner join works_in w 
    on d.eid = w.department,
    physician ph inner join appointment app
    on ph.ph.eid = app.physician
group by ph.eid, ph.name, ph.position, d.name
</code></pre>

<p>How can I write it correctly with inner joins.</p>