SELECT camera.id
FROM camera JOIN camera_features ON camera.id=camera_features.camera_id
GROUP BY camera.id
HAVING sum(camera_features.feature_id IN (1,2,3))=3
3
je počet funkcí v (1,2,3)
. A za předpokladu (camera_id,feature_id)
je jedinečný v camera_features
.