sql - Select from two views and order by both view -



sql - Select from two views and order by both view -

i have 2 views like:

a_team jon joe kate b_team soabo david jim jake

i want select teams 2 views , print in desc.i use

select distinct * a_team union select distinct * b_team order a_team desc;

the output fine. however, output column name 'a_team', how rename column name in output please?

update: using jiggs's reply solved. all.

to alias column you'd (assuming columns area_team , b_team:

select distinct a_team [membername] a_team union select distinct b_team b_team order [membername] desc;

be careful union versus union all -- union remove duplicates between 2 tables, if have "mary" in both tables, you'll see "mary" listed once. utilize union all see twice if desired.

sql sql-server

Comments

Popular posts from this blog

Delphi change the assembly code of a running process -

json - Hibernate and Jackson (java.lang.IllegalStateException: Cannot call sendError() after the response has been committed) -

C++ 11 "class" keyword -