我如何编写查询可找到具有相同订单行(详细信息)的订单?SQL查询查找具有相同订单行的订单
样本数据
表:订单
ORDER_ID
--------
A
B
C
D
表:订单明细
OrderID ProductID
------------------
A ProductX
A ProductY
A ProductZ
B ProductX
B ProductY
C ProductZ
D ProductX
D ProductY
D ProductZ
现在我想通过ProductX,ProductY,ProductZ
并取回A
和D
。
这可以在一个查询中完成吗?
假设有是没有订单表。即使那么所需的结果可以得到礼仪... –