Jump to content

[SOLVED] Mysql MIN


Nandini

Recommended Posts

Hi

I have a mysql database table astaccount. In that there is a field named as accountcode.

In database field accountcode values are 9001,9003,9000,58469.

In those values i want minimum value. For this i am using MIN function. But it is showing 58469 is minimum and 9003 is maximum . But i want 58469 as maximum and 9000 is minimum. here is my code.

<?

$least=mysql_query("select MIN(accountcode) as num from astaccount");

$row=mysql_fetch_array($least);

$lnumber=$row['num'];

echo $lnumber;

?>

Link to comment
https://forums.phpfreaks.com/topic/128476-solved-mysql-min/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.