Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Year function in date range not working
Message
General information
Forum:
Visual FoxPro
Category:
Databases,Tables, Views, Indexing and SQL syntax
Title:
Year function in date range not working
Environment versions
Visual FoxPro:
VFP 9 SP2
Database:
Visual FoxPro
Miscellaneous
Thread ID:
01512452
Message ID:
01512452
Views:
115
I don't know why but I am getting dates (years) that are outside of the bounds of my SQL statement shown below. Why is the YEAR function not working? Neither statement below works within the date range I wanted.
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 ;
		SUBSTR(DTOC(a.ptd), 7, 4) >= "1997" AND SUBSTR(DTOC(a.ptd), 7, 4) <= "2009" AND INLIST(a.Status, "A, B") ;
		ORDER BY a.grpid, a.grpnum ;
	INTO CURSOR tmpActiveBefore2009

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 ;
		BETWEEN(YEAR(a.ptd), 1997, 2009) AND INLIST(a.Status, "A, B") ;
		ORDER BY a.grpid, a.grpnum ;
	INTO CURSOR tmpActiveBefore2009
Next
Reply
Map
View

Click here to load this message in the networking platform