Jump to content

pulling from table then table again


iversonm

Recommended Posts

lets say i have a table called, vegies

it the table vegies have multiple lines each with the row name called=  corn, potatoes, beans, carrots, pea, and turnips

 

now lets say i want to pull from the database but for each row there is also another table called corn, potatoes, beans, carrots, pea, and turnips

 

this is what i dont know how to do

if i want to take the results from the table vegies and then take it and pull from the table that corrispons to the row so like in the row corn it would pull info from the table corn

 

im sorry if this doesnt make sense let me know

Link to comment
Share on other sites

You would have to first read from the vegies table, then use that value to form the second query and run that separately (the value retrieved from the vegie table will be the table name value for the second query). This approach is very limiting.

 

You should not organize your data in that way - a table for each type of veggie. Ideally you would have all vegies in one table and you could have another column to designate further what it is (starch food, yellow food, green food, etc.).

 

Learn about database normalization:

http://www.google.com/search?hl=en&q=database+normalization

 

 

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.