Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Again!! A Sql Problem
Message
From
14/06/1999 23:11:01
 
 
To
14/06/1999 18:59:01
General information
Forum:
Visual FoxPro
Category:
Other
Miscellaneous
Thread ID:
00229776
Message ID:
00229834
Views:
12
>Hello Friends,
>
>I have to apply following validation in my form. I am not sure whether this can
>be accomplished by sql and if yes then how ? Any help is highly appreciated.
>
>I have two fields like following.
>
>dStart dStop
>
>06/14/99 06/20/99
>06/22/99 06/25/99
>
>Now, a new start and stop date can't overlap with others.
>
>06/14/99 - 06/21/99
>06/15/99 - 06/20/99
>for example here are some invalid date ranges for new record.
>
>
>These are not allowed because they are overlapping with previous records.
>
>Thanks in Advance for all your help.
>
>Thanks
>Mark

Do you want to find all records with invalid dates?

for invalid start dates:
SELECT * FROM MyTable Copy1
WHERE dStart IN
(SELECT dStart FROM MyTable Copy2 WHERE BETWEEN(Copy1.dStart, Copy2.dStart, Copy.dEnd)

for invalid end dates:
SELECT * FROM MyTable Copy1
WHERE dEnd IN
(SELECT dEnd FROM MyTable Copy2 WHERE BETWEEN(Copy1.dEnd, Copy2.dStart, Copy.dEnd)

To just validate one set of start and end dates, use Cindy's excellent example.
Erik Moore
Clientelligence
Previous
Reply
Map
View

Click here to load this message in the networking platform