I have two tables Employee and Address. One Employee can have multiple Address. Here I want to fetch 'active employee details' and 'active address details' of a particular emp_id. I can achieve this by below query :
Table Structure:
Employee(emp_id,name,is_active)
Address(add_id,emp_id,address,is_active)
Query:
SELECT * FROM EMPLOYEE e
LEFT OUTER JOIN ADDRESS a
ON e.emp_id=a.emp_id
WHERE e.is_active='A'
AND a.is_active='A';
Using above query it does not return any employee details if no active address. I want to return active employee details anyways even if it does not have any active address.
Note: as I am using Hibernate looking for a query without using ON . Only Where clause can be used here.
Kindly suggest.