Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Oops! MIN & MAX in SQL commands
Message
De
18/02/2003 13:39:54
Cetin Basoz
Engineerica Inc.
Izmir, Turquie
 
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Divers
Thread ID:
00752219
Message ID:
00754576
Vues:
16
>Cetin
>
>>max() function is different from SQL max(). SQL max operates on expressions returning a scalar value.
>>What do you really want to do ? Do aggregation and stil get max of result vs 99 ? Something like max of multiple fields ?
>
>Well I just wanted the arithmetic MAX() function. (Sorry folks - not the SQL version). It seems that the arithmetic MAX() is overloaded by the other one when you use it in a query.
>
>>? max(f1, f2, f3, f4) && Would return max of f1..f4 num fields
>Yes, this one works nicely.
>
>>select iif(nField>99, nField, 99*1) as Column1 from myTable
>The trouble is, what if 'nField' is a longer expression? Then it gets a bit cumbersome to use this syntax. Which is why it would be nice to have the humble MAX() back for simplicity.
>
>>select max(max(nField, 99*1)) as Column1 from myTable
>Are you sure this one will work?
>
>>Note that in last sample outer max is SQL aggreagation function whilst inner max is VFP's max() function.
>Inner one won't work!
>
>Thanks
>John

John,
Did you try the sample ? Inner one works as arithmetiuc max.
Cetin
Çetin Basöz

The way to Go
Flutter - For mobile, web and desktop.
World's most advanced open source relational database.
.Net for foxheads - Blog (main)
FoxSharp - Blog (mirror)
Welcome to FoxyClasses

LinqPad - C#,VB,F#,SQL,eSQL ... scratchpad
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform