Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
How to find first non-vacation day before given date
Message
De
07/02/2006 15:45:53
 
 
À
06/02/2006 18:46:40
Information générale
Forum:
Visual FoxPro
Catégorie:
Base de données, Tables, Vues, Index et syntaxe SQL
Versions des environnements
Visual FoxPro:
VFP 9
Divers
Thread ID:
01093556
Message ID:
01094423
Vues:
18
>>CREATE CURSOR vacation (dstart D,dend D)
>>INSERT INTO vacation VALUES (DATE()-3,DATE()+5)
>>
>>returns empty cursor but correct result is date()-4
>
>with a empty vacation, and dbefore=DATE()
>which is the result ?

Result is year 1.1.1960
This result is wrong, must must be date()-1
SET ENGINEBEHAVIOR 90
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
BROWSE
>If you want the "near before" free day the query is little more complex.

Yes, I want it. The follong code returs 1.1.1960 but must return DATE()-4
SET ENGINEBEHAVIOR 90
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
BROWSE
Andrus
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform