SELECT u.*,h.*,d.*
FROM User u
LEFT JOIN HealthDec h ON u.ID = h.EmpId
LEFT JOIN Document d On u.ID = d.UserID;
和:
SELECT count(id) FROM OHS
WHERE Category = 'POLICIES'
AND ID NOT IN
(
SELECT OHSID
FROM User_OHS
WHERE UserID='1' AND Type='POLICIES'
);
两个查询都可以根据需要分别正常工作。但我想结合这两个查询来为每个用户获取结果。