Jump to content

Recommended Posts

i have a fairly large and poorly designed database (i should know, i designed it meself). essentially it contains about 1500 records, EACH RECORD of a unique ITEM with about 25 fields, mostly just options for said item.

 

for an example,in table 'products', item '3R1' will have a value 'colorset_1' in column 'colorset' which refers to a colorset of, say, 'Black, Brown, or Green' while another item would have the value 'colorset2', referring to the colorset 'Black, Brown or Orange', and so forth.

 

i'm hoping that someone could kindly show me how a relational table would be setup and a query called to get the correct colorset for the correct item.

 

 

i'd be very much obliged. once i see how this is done, i'm sure i'd learn a lot by following this for all the other similar columns...

 

thanks much

GN

Hard to say without knowing the structure of the two tables.. However storing the value 'colorset_1' in a column called `colorset` seems a little pointless to me. Why not just store 1 (as an integer) and use that as the colorset ID within the colorsets table?

 

You'll most likely need to modify it a little, but this should point you in the right direction:

 

 

select items.*, colorsets.value from itemsjoin colorsets on (items.colorset = colorsets.id)where items.id = '3R1';

 

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.