I'm working with 3 tables. oehdrhst, oelinhst, oehdraud.Table layouts are:oehdrhstord_typ ord_no inv_no O 1234 5555 O 1234 6666 Q 5678 2348
oelinhstord_type ord_no item line_no inv_noO 1234 ABC 1 5555O 1234 DEF 2 5555Q 1555 XXX 1 6666O 5678 YYY 1 2348O 5678 TTT 2 2348
oehdraudord_type ord_no ActionO 1234 AO 5678 A
Here is what I'd like to see:ord_type ord_no item line_no ActionO 1234 ABC 1 AO 1234 DEF 2 AQ 1555 XXX 1 NULLO 5678 YYY 1 AO 5678 TTT 2 A
I've tried this and it doesn't seem to work.select *from oelinhst joinoehdrhst on oelinhst.ord_no = oehdrhst.ord_no and oelinhst.inv_no =oehdrhst.inv_no join oehdraud on oehdraud.ord_type = oehdrhst.ord_type and oehdraud.ord_no = oehdrhst.ord_no