1
我试图做一个查询,但我不知道该怎么做。AVG COUNT查询
这些都是表:
Table Hospital Table Doctor Table Work
Hid Country ic Hid ic
1 England 1 1 1
2 Spain 2 1 2
3 France 3 1 3
4 England 4 2 4
5 China 5 4 5
结果,我想:
Country Average of Doctors Working on that Hospitals of that Country
England 2 (the doctor with ic 1, 2, 3, and 4/number of hid)
Spain 1
France 0
China 0
我想:
SELECT DISTINCT H.country, AVG(D.ic)
FROM Hospital H, Doctor D
WHERE H.hid IN
(SELECT W.hid
FROM Work W
WHERE W.ic IN
(SELECT COUNT(D.ic)
FROM D Doctor ....
)
)
GROUP BY(H.country);
能否请您分享您查询? –
我在西班牙看到一名医生,而不是在中国。 –
是的,我的错误。 – tomss