I need help with building SQL query.
I have 4 tables: Sellers, Goods, Projects and Sales.
Sellers table has following structure:
SellerID (int) PK
SellerName (nvarchar)
SellerStatus (int)
SellerCity (nvarchar)
Goods:
GoodsID (int) PK
GoodsTitle (nvarchar)
GoodsColor (nvarchar)
GoodsSize (int)
GoodsCity (nvarchar)
Projects:
ProjectID (int) PK
ProjectTitle (nvarchar)
ProjectCity (nvarchar)
Sales:
SellerID (int)
GoodsID (int)
ProjectID (int)
Price (int)
I need to get Sellers ID’s, which distribute same Goods to all Projects.
Can anybody help me with query?
I use MSSQL.
Thanks in advance
I honestly aint sure if i have understood exactly all the requirements (i did go through all the comments but am a bit confused after that). However, if you want ALL Sellers who have SOLD atleast 1 GOODs to ALL projects, then the below might give you that, i think.
Can you try it out and see if it does? I really have no access to a DB to try it out right now
Also, in case it isnt meeting some requirement which i have missed, please feel free to elaborate a bit, maybe using example data – which might make it simpler for all.