Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

union all

Status
Not open for further replies.

tuzojazz

Programmer
Dec 26, 2005
58
MX
Hi

I have two tables: Employees_Norway and Employees_USA

Employees_Norway:

Employee_ID E_Name
-------------------------------
01 Hansen, Ola
02 Svendson, Tove
03 Svendson, Stephen
04 Pettersen, Kari


Employees_USA:

Employee_ID E_Name
------------------------------
01 Turner, Sally
02 Kent, Clark
03 Svendson, Stephen
04 Scott, Stephen

In order to list all employees in Norway and USA I'm using this query:


------------------------------------------------
SELECT E_Name FROM Employees_Norway
UNION ALL
SELECT E_Name FROM Employees_USA
------------------------------------------------

I get this result


Name
----------------------
Hansen, Ola
Svendson, Tove
Svendson, Stephen
Pettersen, Kari
Turner, Sally
Kent, Clark
Svendson, Stephen
Scott, Stephen

What more does need my query to get the result in alphabetical order?

Thanks!!
 
Stick an order by at the end.
Code:
SELECT E_Name FROM Employees_Norway
UNION ALL
SELECT E_Name FROM Employees_USA
ORDER BY E_Name

Denny
MCSA (2003) / MCDBA (SQL 2000) / MCTS (SQL 2005)

--Anything is possible. All it takes is a little research. (Me)
[noevil]
 
no problem.

Denny
MCSA (2003) / MCDBA (SQL 2000) / MCTS (SQL 2005)

--Anything is possible. All it takes is a little research. (Me)
[noevil]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top