Simpler Navigation for Servers and Operating Systems - Please Update Your Bookmarks
Completed: a much simpler Servers and Operating Systems section of the Community. We combined many of the older boards, so you won't have to click through so many levels to get at the information you need. Check the consolidated boards here as many sub-forums are now single boards.
If you have bookmarked forums or discussion boards in Servers and Operating Systems, we suggest you check and update them as needed.
Showing results for 
Search instead for 
Did you mean: 

Display result record twice

Occasional Contributor

Display result record twice

Pardon me, if this is an old question.
How to get the output the twice ( or number of times ) of a sql statement.

select * from colors
where color_desc in ('BLUE','BLUE')

When executing the above statement, i want the result twice ( since BLUE appears twice ), if more times, that number of result display.

Can you please help me.
Honored Contributor

Re: Display result record twice

Probably lots of ways to do this,
one cheap one that I can think of:

select * from colors
where color_desc ='BLUE'
union all
select * from colors
where color_desc ='BLUE';

or my test:
(select * from dual)
union all
(select * from dual);


"UNION" with the "ALL" modifier keeps the data from being coalesced down to a single row, and stops the UNION command from removing common rows.

We are the people our parents warned us about --Jimmy Buffett