Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
How do I use vfp's min in a vfp sql statement?
Message
De
30/12/1999 19:40:32
 
Information générale
Forum:
Visual FoxPro
Catégorie:
Base de données, Tables, Vues, Index et syntaxe SQL
Divers
Thread ID:
00310771
Message ID:
00310777
Vues:
65
Carl,

Here's a cheezy way to do it:
SELECT MIN(ifid1)AS minfid1,00000 AS minfid2 FROM testmin WHERE ifid1 >= 0 ;
 UNION ;
SELECT 00000 AS minfid1,MIN(ifid2) AS minfid2 FROM testmin WHERE ifid2 >= 0
The first record will contain MIN(ifid1) as minfid1 and the second record will contain MIN(ifid2) as minfid2


>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
------------------------------------------------
John Koziol, ex-MVP, ex-MS, ex-FoxTeam. Just call me "X"
"When the going gets weird, the weird turn pro" - Hunter Thompson (Gonzo) RIP 2/19/05
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform