select type,max(price) as max_price
from t_product
group by type
เขียนคำสั่ง SQL น่าจะประมาณนี้ ลองดู!!!
Date :
2011-02-04 10:19:15
By :
NPPEP
No. 2
Guest
<?
include "connect.php";
$tb="t_product";
$sql="select type,max(price) as max_price from t_product group by type ";
$result2 = mysql_query($sql2);
While($row2= mysql_fetch_array($result2)){
$id=$row["id"];
$price=$row["price"];
$type=$row["type"];
}
?>
include "connect.php";
$sql="select id,type,max(price) as max_price from t_product group by type ";
$result2 = mysql_query($sql);
While($row2= mysql_fetch_array($result2)){
$id=$row["id"];
$type=$row["type"];
$price=$row["max_price"];
}