Jump to content

Query help, 2 databases


jaylam13

Recommended Posts

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

Link to comment
Share on other sites

 

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

Link to comment
Share on other sites

 

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..  :P

JOIN

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.