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!

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.