Let's Try again:
Select A.*, Sum(B.x) as Calc_Amt ;
From A, B ;
Where (Link condition) ;
UNION ;
Select A.*, 0.0 as Calc_Amt ;
From A ;
Where (A.Account+A.Aie_Code NOT IN ;
(SELECT B.Account+B.ItemCode FROM B)
INTO AleSum
or What I prefer and is faster on large data sets:
Select A.*, Sum(B.x) as Calc_Amt ;
From A, B ;
Where (Link condition) ;
INTO DBF AleSum
Select A.*, 0.0 as Calc_Amt ;
From A ;
Where (A.Account+A.Aie_Code NOT IN ;
(SELECT B.Account+B.ItemCode FROM ALESUM);
INTO Cursor T1
if _Tally # 0
SELE T1
xDbf=DBF()
SELE AleSum
Append from (xDBF)
ENDIF
HtwH...
Steve Medvid
Systems Analyst
Environmental Resource Management