您可以执行以下操作:
select ItemIDfrom ItemCategorywhere CategoryID in (5,6,7,8) <-- de-dupe these before building IN clausegroup by ItemIDhaving count(distinct CategoryID) = 4 <--this is the count of unique items in IN clause above
如果您提供架构和一些示例数据,我可以提供一个更相关的答案。
SQL小提琴示例



