Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Looking for the oldest non-blank date
Message
 
To
18/05/2005 19:43:42
General information
Forum:
Visual FoxPro
Category:
Databases,Tables, Views, Indexing and SQL syntax
Environment versions
Visual FoxPro:
VFP 7 SP1
OS:
Windows 2000
Database:
Visual FoxPro
Miscellaneous
Thread ID:
01015389
Message ID:
01015810
Views:
15
Hello Fabio,

>A optimized version:
>SELECT AreaFK, StationFK, CrewFK, ;
>	MIN(EVL(nextminor,{^9999/12/31})) AS NextMinor, ;
>	MIN(EVL(nextmajor,{^9999/12/31})) AS NextMajor, ;
>	.F. AS doMinGroup, .F. AS doMajGroup ;
>	FROM premaint  GROUP BY AreaFK, StationFK, CrewFK ;
>	INTO TABLE maintdue

I think that you meant NVL() instead of EVL(). I tested NVL() and found that for an empty table.datefield it always returns the empty table.datefield and not the constant date supplied in the second parameter.

>Why don't you fill the premaint.nextminor,premaint.nextmajor with {^9999/12/31}) directly ?

Because the users who read the reports would all be confused by that strange date that would show up in many places, and I'd be writing logic in many report fields to blank it out. This SELECT is the only place where it has to be converted to a non-blank date to apply the necessary logic to groups of records.

Thanks,
Randy Bosma
VFP - Because life is too short to code in something else...
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform