How do I select an order with two products in the OrderDetails
?
For example, if I have 4 orders:
order id: 11000 contains: p1, p3, p5, p9
order id: 12000 contains: p1, p4, p5, p8
order id: 13000 contains: p2, p3, p5, p7
order id: 14000 contains: p1, p3, p5, p8
order id: 15000 contains: p2, p3, p6, p9
I want to select order ids where they contain p1 and p9
The expected result: 11000, 12000, 14000
How do I do this in SQL Server?
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…