CREATE TABLE employee(xm CHAR(20),dw CHAR(20));
CREATE TABLE depart(zf CHAR(3),dw CHAR(20));
INSERT INTO employee VALUES('aaaaa','11111');
INSERT INTO employee VALUES('bbbbb','11111');
INSERT INTO employee VALUES('ccccc','11111');
INSERT INTO employee VALUES('ddddd','22222');
INSERT INTO employee VALUES('eeeee','22222');
INSERT INTO employee VALUES('fffff','33333');
INSERT INTO employee VALUES('ggggg','44444');
INSERT INTO employee VALUES('hhhhh','55555');
INSERT INTO employee VALUES('iiiii','55555');
INSERT INTO employee VALUES('jjjjj','55555');
INSERT INTO depart VALUES('123','11111');
INSERT INTO depart VALUES('123','22222');
INSERT INTO depart VALUES('456','33333');
INSERT INTO depart VALUES('456','44444');
INSERT INTO depart VALUES('123','55555');
SELECT distinct(d.zf),count(e.xm) FROM depart d,employee e WHERE d.dw=e.dw
GROUP BY d.zf
ZF COUNT(E.XM)
----------------------
123 8
456 2
不知是否符合你的要求。