>>select ..., nvl(b.desc, space(30)) as desc, ... >>>>
>sele ; > a.pn, ; > nvl(b.desc, space(35)) as desc, ; > nvl(c.name, space(35)) as name ; > distinct ; > from ; > pnvendor a left join inv b on a.pn = b.pn, ; > pnvendor a left join vendor c on a.vendorid = c.vendorid ; > where ; > "1004" $ a.vendorid .and. ; > "04AV205" $ a.pn >I am not sure why it works at all. I assume you want to join a with b, and a with c. I would rewrite this as follows:
sele ; a.pn, ; nvl(b.desc, space(35)) as desc, ; nvl(c.name, space(35)) as name ; distinct ; from ; pnvendor a; left join inv b on a.pn = b.pn, ; left join vendor c on a.vendorid = c.vendorid ; where ; "1004" $ a.vendorid .and. ; "04AV205" $ a.pnThis is not only aesthetic: I omitted the second mention of "pnvendor a". I am not sure whether both versions would produce the same results.