postgresql - SQL UNION Question -


can explain me why sql statement:

select 'test1' union select 'test2' union select 'test3' 

returns:

test2 test3 test1 

i trying figure out logic behind union keyword in aspect. there way return:

test1 test2 test3  

without using order by clause? in other words, can control execution order of union statements?

if matters, using postgre 9.0 , php language

many thanks, brett

according postgresql docs union:

union appends result of query2 result of query1 (although there no guarantee order in rows returned).


Comments

Popular posts from this blog

apache - Add omitted ? to URLs -

redirect - bbPress Forum - rewrite to wwww.mysite prohibits login -

php - How can I stop spam on my custom forum/blog? -