I have 2 tables.One is OrderMaster and second is OrderDetails.Both are connected via OrderId
Order table fields : OrderId(Primary Key),Total,OrderDate
OrderDetail fields : OrderDetailId,ItemId,SupplierId,Amount,OrderId (ForiegnKey)
One order can have multiple orderdetail records which can be from various suppliers
Now i want to get Orders with only a purticular SupplierId value(Ex : 4) and the count (distinct supplierid)=2 .All Orders which have this supplier Id should not be included in the result set as some of it may having other suppliers too.The expected output is OrderId, Sum*Amount for those records which belongs to a particular supplier (Only this supplier in the order)
EDIT : i think Count(supplierId)=1 should be a part of the query.