Re: MAX for a column
| From: | Ron Allen | Date: | Tue, 16 Apr 2002 14:43:44 +0000 |
| Subject: | Re: MAX for a column | ||
| References: | 1 2 | Groups: | php.db |
| Request: | Send a blank email to php-db+get-18546@lists.php.net to get a copy of this message | ||
That worked like a champ....Thanks!!!
"Michael Virnstein" <michael.virnstein@brodos.de> wrote in message
news:20020416142449.85248.qmail@pb1.pair.com...
> If you want the max if HUF, KM, EURO, KUNA you should do
> $sqlquery = "SELECT MAX(HUF) as HUF,MAX(KM) as KM, MAX(EURO) as EURO,
> MAX(KUNA) as KUNA from $table limit 1";
>
> "Ron Allen" <allenr@fwd.areur.army.mil> schrieb im Newsbeitrag
> news:20020416130715.92592.qmail@pb1.pair.com...
> > I am trying to determine how to use the MAX() function
> >
> > I was thinking about this
> > $sqlquery = "SELECT MAX(HUF,KM,EURO,KUNA) from $table limit 1";
> >
> > any suggestions
> >
> > here is the code:
> >
> > mysql_connect($DBhost,$DBuser,$DBpass) or die("Unable toconnect to
> > database");
> > @mysql_select_db("$DBName") or die("Unable to select database
> > $DBName");
> > $sqlquery = "SELECT * FROM $table";
> > $result = mysql_query($sqlquery);
> > $number = mysql_numrows($result);
> > $i = 0;
> > if ($number < 1) {
> > }
> > else {
> > while ($number > $i) {
> > $EURO = mysql_result($result,$i,"EURO");
> > $EURORECON = mysql_result($result,$i,"EURORECON");
> > $KM = mysql_result($result,$i,"KM");
> > $KMRECON = mysql_result($result,$i,"KMRECON");
> > $HUF = mysql_result($result,$i,"HUF");
> > $KUNA = mysql_result($result,$i,"KUNA");
> >
> >
>
>