Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
WHERE Not IN
Message
General information
Forum:
Visual FoxPro
Category:
Databases,Tables, Views, Indexing and SQL syntax
Title:
Environment versions
Visual FoxPro:
VFP 9 SP2
Database:
Visual FoxPro
Miscellaneous
Thread ID:
01512443
Message ID:
01512447
Views:
68
>This is what I have and it isn't quite working; FoxPro doesn't like the subquery.
>
>
>	SELECT ;
>		 " " AS CheckOff, a.grpid, a.grpnum, b.lastname, b.firstname, b.dob, a.Hist, a.PlanKey, a.Status, a. Renewal, ;
>		a.ptd ;
>	FROM grpextcv  a ;
>	JOIN grpextin b ON a.grpid+a.grpnum=b.grpid+b.grpnum ;
>	WHERE a.Hist="99" AND a.GrpID="ACS" AND ;
>		(YEAR(a.ptd) > 1997 AND YEAR(a.ptd) < 2009) AND (INLIST(a.Status, "C, U, T") OR ;
>		INLIST(a.Renewal, "X, C, L, D")) AND a.GrpID =;
>		(SELECT grpID FROM grpextin d WHERE INLIST(Status, "A", "B") AND Hist="99" AND ;
>		d.GrpNum <> a.GrpNum) ;
>		ORDER BY a.grpid, a.grpnum ;
>	INTO CURSOR tmpBefore2009_ACS_Only
>
>
Instead of putting this subquery in WHERE clause move it to JOIN:
SELECT  " " AS CheckOff, a.grpid, a.grpnum, b.lastname, b.firstname, b.dob, a.Hist, a.PlanKey, a.Status, a. Renewal, ;
        a.ptd ;
FROM grpextcv  a ;
INNER JOIN grpextin b ON a.grpid+a.grpnum=b.grpid+b.grpnum ;
INNER JOIN grpID FROM grpextin ON a.GrpID = grpextin.grpID  AND;
                                  grpextin.Status IN("A", "B") AND;
                                  grpextin.GrpNum <> a.GrpNum       AND;
                                  ??????.Hist="99";
WHERE a.Hist="99" AND;
      a.GrpID="ACS" AND ;
      YEAR(a.ptd) BETWEEN 1998 AND 2008 AND;
      (a.Status IN ("C, U, T") OR ;
       a.Renewal IN ("X, C, L, D"));
ORDER BY a.grpid, a.grpnum ;
INTO CURSOR tmpBefore2009_ACS_Only
Not Tested!
Against Stupidity the Gods themselves Contend in Vain - Johann Christoph Friedrich von Schiller
The only thing normal about database guys is their tables.
Previous
Reply
Map
View

Click here to load this message in the networking platform