Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
MIN() MAX() in SQL on multiple fields
Message
De
06/04/2015 16:32:00
Lutz Scheffler
Lutz Scheffler Software Ingenieurbüro
Dresden, Allemagne
 
Information générale
Forum:
Visual FoxPro
Catégorie:
Autre
Versions des environnements
Visual FoxPro:
VFP 9 SP1
OS:
Windows 7
Network:
Windows 2008 Server
Database:
Visual FoxPro
Application:
Web
Divers
Thread ID:
01617834
Message ID:
01617845
Vues:
41
>Ok, thanks. I was hoping for a more glorious solution, but that is what I had in mind as well.


If don't like IIF there is an other kludge

create an function My_Min like
PROCEDURE My_Min
LPARA;
v1,v2,..,v26

do case
 case pcount()=2
  return min(v1,v2)
 case pcount()=3
  return min(v1,v2,v3)
..
 case pcount()=26
  return min(v1,v2,v3,..,v26)
 otherwise
* 0,1 is a bit meaningless
  return .NULL.
ENDCASE
ENDPROC
your SQL
SELECT
 MIN(My_Min(n1,n2,n3)) AS nMinResult;
 FROM ....
Words are given to man to enable him to conceal his true feelings.
Charles Maurice de Talleyrand-Périgord

Weeks of programming can save you hours of planning.

Off

There is no place like [::1]
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform