$sql_group="SELECT * FROM productgroup INNER JOIN products_pictures ON productgroup.progroup_id=products_pictures.progroup_id WHERE 1 and products_pictures.cpro_id='".$_GET["cpro_id"]."' order by products_pictures.pro_id desc ";
ให้เลือกเฉพาะบางฟิวด์ SELECT * FROM productgroup ครับ และก็ใช้ DISTINCT เอาครับ
เช่น
Code
SELECT DISTINCT f1,f2,f3 FROM productgroup
Date :
2012-01-11 21:29:56
By :
webmaster
No. 2
Guest
เราลองแบบนี้ $sql_group="SELECT DISTINCT progroup_id,cpro_id,progroup_name,date FROM productgroup INNER JOIN products_pictures ON productgroup.progroup_id=products_pictures.progroup_id WHERE 1 and products_pictures.cpro_id='".$_GET["cpro_id"]."' order by productgroup.progroup_id desc";
มันขึ้น error
Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource in C:\AppServ\www\cp.php on line 122
$sql_group="SELECT * FROM productgroup INNER JOIN products_pictures ON productgroup.progroup_id=products_pictures.progroup_id WHERE 1 and products_pictures.cpro_id='".$_GET["cpro_id"]."' order by productgroup.progroup_id desc ";