Link to home
Start Free TrialLog in
Avatar of chinmaya224
chinmaya224Flag for India

asked on

Outer Join with Condition

i am joining 2 tables ..... here i am writing the query

SELECT A.*,B.*
FROM MATL_MSTR A,
         MATL_PROD B,
         MATL_DISPATCH C
WHERE A.MATL_ID = B.MATL_ID AND
            A.MATL_ID = C.MATL_ID(+);

Here i want to put one more condition with the outer join table (MATL_DISPATCH) i.e C.matl_sts = '75'.

IF i am directly using this condition then i am not getting all matl_id. Please help me and explain me how to use a condition in outer join table and that should be executed only when the outer join table has the data for that matl_id.
Avatar of Pratima
Pratima
Flag of India image

Not get what exactly you want
but as per understaning you want to include the data from table  MATL_DISPATCH C
if it excists with condition C.matl_sts = '75'

then try this

SELECT A.*,B.* , C.*
FROM MATL_MSTR A Inner join
         MATL_PROD B on A.MATL_ID = B.MATL_ID,
         Left join MATL_DISPATCH C On A.MATL_ID = C.MATL_ID and C.matl_sts = '75'
ASKER CERTIFIED SOLUTION
Avatar of leclaude
leclaude
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of chinmaya224

ASKER

Thank You ..