mysql - Explode prevsiouly rolled up data in SQL -
mysql - Explode prevsiouly rolled up data in SQL -
i have info follows:
product quantity 3 b 2
this info been rolled @ product level. assume there 2 columns of now.
i want output follows:
product quantity 1 1 1 b 1 b 1
you utilize trick this:
select product, 1 quantity products inner bring together ( select 1 q union select 2 union select 2 union select 3 union select 3 union select 3 ) quantities on products.quantity = quantities.q
of course, query limited quantity of 3, can add together more quantities subquery if of limited amount.
mysql
Comments
Post a Comment