SQL Server 2005.結果必須包含特定值的鏈接表上的SQL查詢
我有一個關聯產品和屬性的鏈接表。我在做線沿線的一個搜索:
select distinct ProductId from productattributelink where
attributeid in (25,5,44,46)
但我想確保每個產品ID也與10
因此,一個屬性ID在手寫的查詢是相關的:讓我看看所有產品ID都有以下attributeids(25,5,44,46),但也有10的attributeid。
我有一種感覺,這是真的很明顯,但是逃避我。
不知道這兩個答案是第一,想必這一個。所以謝謝你,工作得很好。 – scaryjones 2011-06-15 09:47:48