jaylam13 Posted September 20, 2011 Share Posted September 20, 2011 Hi, Can anyone help please, I want to reference a field from one database to another. So I have two databases: db1 has tables called ID and Name db2 has tables called ID and Stock In db1 the ID field is a number and the name is the Name of that item. In db2 the fields are populated by people selecting items from a drop down list box which is populated via db1. The ID field in db2 is just a auto incremented number and the Stock becomes the ID of what every they have selected from the drop downlist box populated by db1. This works but when the user views his stock obviously it just shows a number what I would like the query to do is grab Stock value from db2, look that up in db1 as it will match a ID then use the Name for the item from db1. I hope this makes sense, is it possible if so how do I go about it.....im confused. Thanks in advance Jay Quote Link to comment Share on other sites More sharing options...
AyKay47 Posted September 20, 2011 Share Posted September 20, 2011 look into using a Union Quote Link to comment Share on other sites More sharing options...
mikosiko Posted September 20, 2011 Share Posted September 20, 2011 look into using a Union sure you tried to say JOIN instead of UNION right? Quote Link to comment Share on other sites More sharing options...
AyKay47 Posted September 20, 2011 Share Posted September 20, 2011 look into using a Union sure you tried to say JOIN instead of UNION right? well since both tables have the same number of columns here.. a UNION will work. unless im misunderstanding the OP Quote Link to comment Share on other sites More sharing options...
mikosiko Posted September 20, 2011 Share Posted September 20, 2011 This works but when the user views his stock obviously it just shows a number what I would like the query to do is grab Stock value from db2, look that up in db1 as it will match a ID then use the Name for the item from db1. well since both tables have the same number of columns here.. a UNION will work. unless im misunderstanding the OP well... seems to me that you did Quote Link to comment Share on other sites More sharing options...
AyKay47 Posted September 20, 2011 Share Posted September 20, 2011 This works but when the user views his stock obviously it just shows a number what I would like the query to do is grab Stock value from db2, look that up in db1 as it will match a ID then use the Name for the item from db1. well since both tables have the same number of columns here.. a UNION will work. unless im misunderstanding the OP well... seems to me that you did yep i did.. JOIN Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.