MySQL Forums
Forum List  »  Stored Procedures

Procedure that select different number of columns
Posted by: Zawisza Czarny
Date: October 15, 2013 01:45PM

Hi!.
I have a big problem with displayng data stored in my database.

I have a couple of tables.
1. Table 'groups' (group ID, group name)
2. Table of 'groups preferences'. (e.g. group with ID 1 has parameter type A and B group with ID 2 has parameters B, F and G number of parameters isn't fixed)
 
GROUP_ID | PARAMETER_ID
 1       | A
 1       | B
 2       | B
 2       | F
 2       | G
3. Table 'items' (item ID, item name)
4. Table 'values'
ITEM_ID | PARAMETER_ID | VALUE 
 1      | A            | 5
 1      | B            | abrakadabra
 2      | B            | skdf
 2      | F            | 876,4
 2      | G            | @#$%

And now I need to view for group 1
ITEM_ID | ITEM_NAME | PARAMETER A | PARAMETER B
for group B
ITEM_ID | ITEM_NAME | PARAMETER B | PARAMETER F | PARAMETER G
and so on.

What I need to do, to achive this?

Options: ReplyQuote


Subject
Views
Written By
Posted
Procedure that select different number of columns
2514
October 15, 2013 01:45PM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.