Jump to content

Making a selection from a lookup table return values from another table


Zimbo

Recommended Posts

I'm working on coding a crop selection tool.

I've got 2 tables:

crop_lut 118 rows -- 4 columns: management_goal, planting_duration, planting_season, crop

crop_db 16 rows -- 10 columns: crop, cost, supplier, planting_tips,...

 

A user makes a selection from the crop_lut using any or all of the first 3 categories, crop is not available for them to query.

The resulting query (it could be 118 rows if no choice is made) needs to pull the crop data from the crop_db table. As there are only 16 crops that's all that should be displayed. Redundant crop matches from the look up table should be ignored.

 

I've been searching for a solution and have come up empty. The only thing I can think to do is send the results from a query to the look up table through a loop to pull crop matches out, then build a second query to send to the crop db to run those results. Seems like the long way around and though I can make it work I think there must be a better way.

Anybody got a recommendation, just looking to be pointed in a direction.

 

Thanks!

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.