Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
![]() |
![]() |
Home -> Community -> Usenet -> c.d.o.server -> "un-grouping" results
All-
I'm looking for a way to pretty much do the opposite of a group by, count statement. Assuming I have a table with the following data:
ID Quantity
-- --------
1 4 2 3
How would I use a select statement to return the following result set?:
ID
--
1
1
1
1
2
2
2
Where I return a separate row for each id up to the quantity value for that row. I have a solution in place using a temp table and cursor but I figure there must be a better way.
Thanks in advance. Received on Thu Feb 03 2005 - 15:08:24 CST
![]() |
![]() |