>>* 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, I am not following the thread so I couldn't be in help but for this query you always will get an empty cursor because DEnd is DATE()+5 and the condition WHERE dend < m.dbefore always will return .F. because dbefore=DATE()
Against Stupidity the Gods themselves Contend in Vain - Johann Christoph Friedrich von Schiller
The only thing normal about database guys is their tables.