Hi ,
Here is one of my famous requirements again .
And here is Supposed to be the output that is supposed to be shown
i know i can achieve this by using a series of decodes in a subquery which is summed up in the outer query
like
I am just wondering if there is a more efficent way of doing this view. here are some more details : The Flowers table(master table) has around 60 selections. There are more than 20000 orders and i am sure the performance of this is going to be b.a.d .
I am not very happy with the second option of a denormalised table being created for this report ( the table would be populated by an SP which will use cursors to route through all orders and put an X in each one of the 60 columns where the order has chosen that flower)...... any other ideas , folks?
Regards,
S. Jayaram Uparna .

Here is one of my famous requirements again .
Code:
[COLOR=blue]Table : Flowers [/color]
[b]
FL_ID NAME PRICE[/b]
1 Chrysanthemum 1.09
2 Catstail 1.32
3 RedRoses 6.12
[COLOR=blue]Table : Orders [/color]
[b]
O_ID FL_ID[/b]
101 1
101 3
201 2
301 3
401 1
401 2
401 3
And here is Supposed to be the output that is supposed to be shown
Code:
[COLOR=blue]
[b]
OrderNumber Chrysanthemum Catstail RedRoses [/color][/b]
101 X X
201 X
301 X
401 X X X
i know i can achieve this by using a series of decodes in a subquery which is summed up in the outer query
like
Code:
SELECT O_ID, MAX(Chrysanthemum), Max(Catstail), Max(RedRoses)
FROM
(Select O_id ,
Decode(Fl_ID , 1,'X',2,NULL,3,NULL) Chrysanthemum,
Decode(Fl_ID , 1,NULL,2,'X',3,NULL) CatsTail,
Decode(Fl_ID , 1,NULL,2,NULL,3,'X') RedRoses
FROM ORDERS
)
GROUP BY O_ID
I am just wondering if there is a more efficent way of doing this view. here are some more details : The Flowers table(master table) has around 60 selections. There are more than 20000 orders and i am sure the performance of this is going to be b.a.d .
I am not very happy with the second option of a denormalised table being created for this report ( the table would be populated by an SP which will use cursors to route through all orders and put an X in each one of the 60 columns where the order has chosen that flower)...... any other ideas , folks?
Regards,
S. Jayaram Uparna .