This looks like an horrible EAV design.-- *** Test Data ***DECLARE @FieldVals TABLE( product_id int NOT NULL ,fielddef_id int NOT NULL ,[value] varchar(50) NOT NULL)INSERT INTO @FieldValsSELECT 1, 8, 'Some post junk'UNION ALL SELECT 1, 9, 'Another post junk'UNION ALL SELECT 1, 12, '12 bedrooms and 6 bathrooms'UNION ALL SELECT 1, 24, 'The price is exorbitant'UNION ALL SELECT 2, 8, 'Some post junk'UNION ALL SELECT 2, 12, '12 bedrooms and 6 bathrooms'UNION ALL SELECT 2, 24, 'The price is exorbitant'UNION ALL SELECT 3, 12, '12 bedrooms and 6 bathrooms'UNION ALL SELECT 4, 12, '12 bedrooms and 6 bathrooms'UNION ALL SELECT 4, 24, 'The price is exorbitant'-- *** End Test Data ***SELECT product_idFROM @FieldValsWHERE (fielddef_id IN (8,9) AND [value] LIKE '%post%') OR (fielddef_id = 12 AND [value] LIKE '%bedrooms%') OR (fielddef_id = 24 AND [value] LIKE '%price%')GROUP BY product_idHAVING COUNT(*) >= 3