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

Popular posts from this blog

formatting - SAS SQL Datepart function returning odd values -

c++ - Apple Mach-O Linker Error(Duplicate Symbols For Architecture armv7) -

php - Yii 2: Unable to find a class into the extension 'yii2-admin' -