triphen
asked on
SyBase SQL Syntax
Hey guys,
I have 2 tables using SyBase SQL Anywhere 10
Employee Table
EmpNum
Firstname
Lastname
Sales Table
Transact
WhoStart (EmpNum)
WhoClosed (EmpNum)
I want to return the transaction number and the first name’s of the employee who started and closed the sale. Usually the person who starts and closes is the same, but sometimes it’s not.
Help?
I have 2 tables using SyBase SQL Anywhere 10
Employee Table
EmpNum
Firstname
Lastname
Sales Table
Transact
WhoStart (EmpNum)
WhoClosed (EmpNum)
I want to return the transaction number and the first name’s of the employee who started and closed the sale. Usually the person who starts and closes is the same, but sometimes it’s not.
Help?
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Tangent... Personally I *HATE* the ANSI join syntax. I find it much harder to read than the "old" join syntax. For this query, it's not bad but, as it gets more complex, the less I like ANSI joins.
ASKER
Thanks guys! I ended up using the ANSI join syntax.
left outer join dba.employee as es
on es.empnum = header.whostart
left outer join dba.employee as ec
on ec.empnum = header.whoclose
left outer join dba.employee as es
on es.empnum = header.whostart
left outer join dba.employee as ec
on ec.empnum = header.whoclose