I want to union several select statements together to form a single result set that them ordered with an even distribution of the rows from each of the individual selects.
i.e
If first SELECT returns...
COL1 ROWNUM
---- ------
'ABC' 1
'DEF' 2
'GHI' 3
and a second SELECT returns...
COL1 ROWNUM
---- ------
'RST' 1
'UVW' 2
'XYZ' 3
the UNION results ordered by ROWNUM would be...
COL1 ROWNUM
---- ------
'ABC' 1
'RST' 1
'DEF' 2
'UVW' 2
'GHI' 3
'XYZ' 3
The question is how can I produce ROWNUM on the fly as part of the SELECT statement or is their another way (do I have to use stored procedures ?)
Help!!
i.e
If first SELECT returns...
COL1 ROWNUM
---- ------
'ABC' 1
'DEF' 2
'GHI' 3
and a second SELECT returns...
COL1 ROWNUM
---- ------
'RST' 1
'UVW' 2
'XYZ' 3
the UNION results ordered by ROWNUM would be...
COL1 ROWNUM
---- ------
'ABC' 1
'RST' 1
'DEF' 2
'UVW' 2
'GHI' 3
'XYZ' 3
The question is how can I produce ROWNUM on the fly as part of the SELECT statement or is their another way (do I have to use stored procedures ?)
Help!!