This week's book giveaway is in the OO, Patterns, UML and Refactoring forum.
We're giving away four copies of Refactoring for Software Design Smells: Managing Technical Debt and have Girish Suryanarayana, Ganesh Samarthyam & Tushar Sharma on-line!
See this thread for details.
The moose likes JDBC and Relational Databases and the fly likes uncleared on query result while applying left outer join Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

JavaRanch » Java Forums » Databases » JDBC and Relational Databases
Bookmark "uncleared on query result while applying left outer join" Watch "uncleared on query result while applying left outer join" New topic

uncleared on query result while applying left outer join

upanshu vaid
Ranch Hand

Joined: Sep 07, 2012
Posts: 81

Hi Ranch,
I am getting the following result while running the following query
select E.Lname As Employee_name,
S.Lname As Supervisor_name
from (EMPLOYEE As E left outer join EMPLOYEE As S
ON E.Super_ssn=S.Ssn)

Employee_name Supervisor_name
Smith Smith
Wong Wong
English English
Narayan Narayan
Borg Borg
Wallace Wallace
Jabbar Jabbar
Zelaya NULL

As per me result should be

Employee_name Supervisor_name
Smith Wong
Wong Borg
English Wong
Narayan Wong
Wallace Borg
Jabbar Wallace
Zelaya Wallace

Employee table i am using

Fname Minit Lname Ssn Bdate Address Sex Salary Super_ssn Dno
John B Smith 123456789 1965-01-09 731 Fondren,Houston,TX M 30000.00 123456789 5
Franklin T Wong 333445555 1955-12-08 638 Voss,Houston,TX M 40000.00 333445555 5
Joyce A English 453453453 1972-07-31 5631 Rice,Houston,TX F 25000.00 453453453 5
Ramesh K Narayan 666884444 1962-09-15 975 Fire Oak,Humble,TX M 38000.00 666884444 5
James E Borg 888665555 1937-11-10 450 Stone,Houston,TX M 55000.00 888665555 1
Jennifer S Wallace 987654321 1941-06-20 291 Berry,Bellaire,TX F 43000.00 987654321 4
Ahmad V Jabbar 987987987 1969-03-29 980 Dallas,Huston,TX M 25000.00 987987987 4
Alicia J Zelaya 999887777 1968-01-19 3321 Castle,Spring,TX F 25000.00 NULL 4

kindly help on understanding the result of this .Fname

I agree. Here's the link:
subject: uncleared on query result while applying left outer join
jQuery in Action, 3rd edition