Tamar,
Here's where it really got me. I've been trying to fix problems in a former programmer's code. Here's his original code.
SELECT a.FR, b.Date - 1,;
SUM(IIF(ISNULL(a.Total_Pcs),000000,a.Total_Pcs)) AS Qty, ;
SUM(a.Total_PCs*(g.StdHrs)) AS Hours,;
SUM(a.Total_Pcs * c.Cost) AS Cost,;
e.Group, ;
g.StdHrs AS StdHrs,;
c.Cost AS Price,;
h.Finish;
FROM Yields h,TemStdHrs g, FRData c,fr d, CellGrp e, Audit2 a;
LEFT JOIN Log85 b;
ON a.Audit_No == b.Audit_No;
WHERE b.Date >= gdbegdate+1;
AND a.Ct_Pointed = .T.;
AND !EXIST(SELECT FR FROM CoatNoUse k;
WHERE k.FR = a.FR);
AND c.FR = a.FR;
AND g.FR = a.FR;
AND d.FR = a.FR;
AND h.FR = a.FR;
AND e.TeamNumber = d.TeamNumber;
AND !EMPTY(a.FR);
AND !EMPTY(b.Date);
GROUP BY a.FR, b.Date;
ORDER BY e.Group,a.FR, b.Date;
INTO ARRAY laMTDDock
I first changed the ! EXIST portion to a.FR # k.FR on a LEFT JOIN between the tables and it worked just fine. When I moved it to VFP8, I had to use an ISNULL() in the field conditions. ISNULL() in VFP6 returns an empty table. I finally went back to a su-select query and got my results. (I also cleaned it up with aliases that meant something and used SYS(3054) to find slow spots. Indexes (indices) were something that he couldn't comprehend as making a difference in queries! Anyway, the CoatNoUse table only had six records but the whole query was dramatically impacted by checking the table.
Thanks again,
Tim
Duty is ours, the results are God's - John Quincy Adams