glennnall Posted October 6, 2010 Share Posted October 6, 2010 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 Quote Link to comment https://forums.phpfreaks.com/topic/215259-help-getting-started-with-a-somewhat-advanced-db/ Share on other sites More sharing options...
Adam Posted October 7, 2010 Share Posted October 7, 2010 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'; Quote Link to comment https://forums.phpfreaks.com/topic/215259-help-getting-started-with-a-somewhat-advanced-db/#findComment-1119706 Share on other sites More sharing options...
glennnall Posted October 9, 2010 Author Share Posted October 9, 2010 this was more help than you think, in fact. thanks very much... Quote Link to comment https://forums.phpfreaks.com/topic/215259-help-getting-started-with-a-somewhat-advanced-db/#findComment-1120550 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.