为什么以下 SQL 查询返回错误?
SELECT COUNT (DISTINCT rm.id)
FROM ts_room rm
LEFT JOIN ts_roomfacilities rf
ON rm.id = rf.room_id
LEFT JOIN ts_facilities f
ON f.id = rf.facilities_id
LEFT JOIN ts_building b
ON rm.building_id=b.id;
乍一看似乎合乎逻辑!
这是我的 SQLFiddle - http://sqlfiddle.com/#!2/a59fc/20