SQLTeam.com | Weblogs | Forums

Help on right outer join


#1

Hi,

I need help on right outer join query

select * from PO_mstr
right outer join voucher_mstr on PO_mstr.domain = voucher_mstr.domain and voucher_mstr.ref = PO_mstr.ref

this outer join is behaving like inner join, I need all records from voucher_mstr even when voucher_mstr.ref = PO_mstr.ref does not match.

Any suggestion will be helpfull

Thanks in advance.


#2

If it's behaving like an inner join, you have a WHERE condition on a column from PO_mstr. Move that condition into the right join instead:

right outer join voucher_mstr on 
    PO_mstr.domain = voucher_mstr.domain and 
    PO_mstr.ref = voucher_mstr.ref and
    PO_mstr.other_column = 'other_value'