I do not have enough reputation to post images. So here's the scenario.
PartsID in CostPrice(databse table) relies on PartsID in PartsInfo(database table). Lets say when the PartsInfo.PartsID = 1, In CostPrice will only show all the related information of 1.
I'm using VS2010 and i try to build a query in datagridview,
SELECT costprice.costid,
costprice.suppliername,
costprice.costprice
FROM costprice
INNER JOIN partsinfo
ON costprice.partsid = partsinfo.partsid
This is my query now, it still shows all the data kept in the database tables. I would like to know the query for my situation.
SELECT CostPrice.CostID, CostPrice.SupplierName, CostPrice.CostPrice
FROM CostPrice
INNER JOIN PartsInfo ON CostPrice.PartsID = PartsInfo.PartsID
WHERE CostPrice = 1
or
SELECT CostPrice.CostID, CostPrice.SupplierName, CostPrice.CostPrice
FROM CostPrice
INNER JOIN PartsInfo ON CostPrice.PartsID = PartsInfo.PartsID
WHERE PartsInfo.PartsID = 1
Not sure which you want.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.