create cursor tbl1 ( scode c(2) ) insert into tbl1 values ( "c1" ) insert into tbl1 values ( "c2" ) insert into tbl1 values ( "c3" ) insert into tbl1 values ( "c4" ) create cursor tbl2 ( scode c(2), itemcode c(4), qty i ) insert into tbl2 values ( "c1", "itm4", 1 ) insert into tbl2 values ( "c2", "itm2", 2 ) insert into tbl2 values ( "c3", "itm3", 1 ) insert into tbl2 values ( "c4", "itm1", 4 ) select distinct itemcode ; from tbl2 ; into cursor allItems nofilter select tbl1.scode, allitems.itemcode, tbl2.qty ; from tbl1 ; full outer join allItems ; on .t. ; left join tbl2 ; on tbl1.scode = tbl2.scode and allitems.itemcode = tbl2.itemcode ; into cursor x1 ; having ! isnull( tbl1.scode )this will give you a result with .null. values in the qty column for rows that don't match up. you can use nvl() to convert these to 0 values instead. But it may be useful to you to know the difference between a tbl2 row with 0 qty from missing rows.