Reputation: 155
Hello this is what i have in mind but no idea how to properly do it.
Table1
ID ID2 Name Dosage
------------------------------
1 001 Name1 Dosage1
2 002 Name2 Dosage2
3 003 Name3 Dosage3
Table2
ID Quantity
------------------------
1 1000
2 2000
3 3000
Query something like:
Select ID,Name,Dosage from Table1 and Quantity(of the same ID from Table1)from Table2 where ID2 from Table1 ='002';
Datagridview Output
ID Name Dosage Quantity
---------------------------------
2 Name2 Dosage2 2000
Upvotes: 0
Views: 107
Reputation: 6557
From the comment you gave to the another answer. You should fix it to look like this:
DECLARE @SupID INT = 200049;
SELECT SP.ProductID, SP.Brand, SP.Dosage, P.Quantity
FROM Supplier_productlist AS SP
INNER JOIN Products AS P
ON P.ID = SP.ProductID
WHERE SP.SupplierID = @SupID;
In case SupplierID
is a "string", declare it like this instead:
DECLARE @SupID NVARCHAR(10) = '200049';
Upvotes: 0
Reputation: 394
A simple SQL join should work. Try this :
select Table1.ID, Table1.Name, Table1.Dosage, Table2.Quantity
from Table1
inner join Table2 on Table2.ID = Table1.ID
where Table2.ID2 = '002';
Upvotes: 1