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 strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

SELECT patient_no, room_no, employe

Status
Not open for further replies.

postmannie

Technical User
May 14, 2002
3
GB
SELECT patient_no, room_no, employee_no, department
FROM patient RIGHT OUTER JOIN dentist
ON dentist_no = employee_no

Is there any way to produce a query using UNION for the above statement (no join)

Cheers

PM
 
The UNION operation lets you combine the results of two or more different SQL statements into one answer set. You can combine many different tables or SQL statements using the UNION operator, the only restriction is that every table or SQL statement must have the same type,number and order of columns.

Therefore if you wish to UNION these 2 tables you need to be selecting columns which are the same type on each table and also the same number of columns.

Why don't you want to do the JOIN as is?
 
You could use a nested query via IN.

SELECT patient_no, room_no, employee_no, department
FROM patient
where employee_no in
( sel dentist_no from dentist );

However the outer join may handles NULL values differently.

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top