标签: postgresql
有3张桌子,我只想显示那些在一项运动中取得成绩并取得记录,但从未参加过其他运动的人。我应该怎么计数?
SELECT p.ID, p.name FROM people p, results r, sports s WHERE r.result=s.record AND p.ID=r.peopleID AND r.sportID=s.ID GROUP BY p.ID HAVING COUNT(r.sportID) = 1;