我必须编写一个php
脚本来查找数据库表中列的三个最大数字。到目前为止,这是我的代码,但它不起作用。
<?php
$con=mysql_connect("localhost","root","");
$db=mysql_select_db("pool");
$res1=mysql_query("SELECT * FROM buy ORDER BY value LIMIT 3 ");
while($r1=mysql_fetch_array($res1)){
echo $r1['value'];
}
?>
答案 0 :(得分:3)
试试这个
SELECT * FROM `buy` ORDER BY `value` DESC LIMIT 3