Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
How to find first non-vacation day before given date
Message
From
06/02/2006 14:32:28
 
 
To
03/02/2006 19:25:31
General information
Forum:
Visual FoxPro
Category:
Databases,Tables, Views, Indexing and SQL syntax
Environment versions
Visual FoxPro:
VFP 9
Miscellaneous
Thread ID:
01093556
Message ID:
01094060
Views:
25
>* IF dstart is not nullable this is better
>SELECT NVL(MAX(T1.dend)+1,date(1960,1,1)) dFreeMaxFirst ;
> FROM vacation T1 ;
> WHERE dend < m.dbefore;
> AND dend + 1 NOT IN (SELECT dstart FROM vacation);
> INTO CURSOR result

Fabio, thank you. I can assume that dstart is NOT NULL
I tried code
CREATE CURSOR vacation  (dstart D,dend D)
INSERT INTO vacation  VALUES (DATE()+3,DATE()+5)

dbefore=DATE()
SELECT NVL(MAX(T1.dend)+1,date(1960,1,1)) dFreeMaxFirst ;
	FROM vacation T1 ;
	WHERE dend < m.dbefore;
		AND dend + 1 NOT IN (SELECT dstart FROM vacation);
		 INTO CURSOR result
? dFreeMaxFirst
Currect result is DATE()-1 but this code returs empty cursor.


Also

CREATE CURSOR vacation (dstart D,dend D)
INSERT INTO vacation VALUES (DATE()-3,DATE()+5)

returns empty cursor but correct result is date()-4
Andrus
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform