Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
How do I use vfp's min in a vfp sql statement?
Message
 
To
All
General information
Forum:
Visual FoxPro
Category:
Databases,Tables, Views, Indexing and SQL syntax
Title:
How do I use vfp's min in a vfp sql statement?
Miscellaneous
Thread ID:
00310771
Message ID:
00310771
Views:
86
I want to use the VFP min function in a sql statement, but it gives me an error, because the sql min function doesn't work the same. In this example, the second one works, but I am wondering if there is a faster way.

create table foo ( iFid1 i, iFid2 i )
insert into foo values (-1,-1)
insert into foo values (-1,1)
insert into foo values (1,-1)
insert into foo values (1,0)
insert into foo values (1,1)
insert into foo values (0,0)

select min( 0, iFid1 ) as iMin1, min( 0, iFid2) as iMin2 ;
from foo ;
having min( iMin, iMin2 ) < 0

select iif( ifid1<0, ifid1, 0 ) as iMin1, iif( iFid2<0, iFid2, 0 ) as iMin2 ;
from foo ;
having iMin1 < 0 or iMin2 < 0
Next
Reply
Map
View

Click here to load this message in the networking platform