6 hours ago, mdsiddiqali wrote
I have a problem in getting value of a field from other table,I created the table 1 with fields of product name,cost,In Table 2 i created product name which is a look up from table one and cost and quantity,My task is when i select product i should get cost automatically.
Products( ID, ProductName, Cost )
Table2( ID, ProductName, Quantity )
SELECT Products.ID, Products.ProductName, Products.Cost, Table2.Quantity FROM Table2 INNER JOIN Products ON Table2.ProductName = Products.ProductName
Note that this is bad normalisation because you're defining a relationship based on a textual value, rather than an integer ID.
This sounds suspiciously like undergraduate databases homework...