C
Calvin
I want to output the results of a select statement into two columns. Half of
all records will go in the first column, remaining half will go into the
second column.
Like this select statement will return one column "userid".
SELECT userid
FROM grouptable
userid
--------
89
90
34
23
67
33
But I want to output this userid column into two columns - userid1 and
userid2, where userid1 will have half the results and userid2 will have the
remaining half of the results.
userid1 userid2
------ ---------
89 23
90 67
34 33
( The number of rows returned will always be even, so they can be divided
into two columns.)
Any idea for a sql script is much appreciated.
Thanks.
all records will go in the first column, remaining half will go into the
second column.
Like this select statement will return one column "userid".
SELECT userid
FROM grouptable
userid
--------
89
90
34
23
67
33
But I want to output this userid column into two columns - userid1 and
userid2, where userid1 will have half the results and userid2 will have the
remaining half of the results.
userid1 userid2
------ ---------
89 23
90 67
34 33
( The number of rows returned will always be even, so they can be divided
into two columns.)
Any idea for a sql script is much appreciated.
Thanks.