Hi all,
I have a problem at hand. A table BEERS looks as follows:
BEER_NAME QUANTITY PRIORITY
Budweiser 17 1
Budweiser 16 2
Corona 22 1
Heineken 9 1
Heineken 11 3
Guinness 15 2
Corona 2 2
Heineken 13 2
Here, I would like to arrange Beers in cases based on priority.
No beer of different brand should go in the same case.
No beer with same brand with different priority should go in the same case.
The maximum number of bottles that can be accomodated in a case is 10.
I wish to have a query which gives the result as follows:
BEER_NAME QUANTITY PRIORITY
Budweiser 10 1
Budweiser 7 1
Budweiser 10 2
Budweiser 6 2
Corona 10 1
Corona 10 1
Corona 2 1
Heineken 9 1
Heineken 10 3
Heineken 1 3
Guinness 10 2
Guinness 5 2
Corona 2 2
Heineken 10 2
Heineken 3 2
How would I get this?
oracle Database Version: Enterprise Edition 10.2.0.1
Regards,
...