Is there only one record per customer per table (or zero) then something like this should work (never used VFP 5, so not sure on that account, but it is easy to test :))
select NVL(T1.CustNo, T2.CustNo) as CustNo, ;
NVL(t1.Sales, 0) + NVL(t2.Sales, 0) as Sales ;
FROM table_1 t1 ;
FULL JOIN table_2 t2 on t1.CustNo == t2.CustNo
>Hi All:
>
>Please consider the following:
>
>
>Table1:
>
>Custno Sales
>ABCD 40000
>XYZS 20000
>
>Table2:
>
>Custno Sales
>XYZS 100
>YYYY 7000
>
>
>I want to come up with SQL that will generate a cursor called cursor1 with total sales for each customer:
>
>
>Cursor1:
>
>Custno TotalSales
>ABCD 40000
>XYZS 20100
>YYYY 7000
>
>
>Note that custno ABCD is absent from table2, XYZS is present in both and YYYY is absent from table1. Also, please note that this is for VFP 5, so nesting SELECTs may not work.
>
>Thanks,
>
>Yossi
"The five senses obstruct or deform the apprehension of reality."
Jorge L. Borges?
"Premature optimization is the root of all evil in programming."
Donald Knuth, repeating C. A. R. Hoare
"To die for a religion is easier than to live it absolutely"
Jorge L. Borges