xiaodao
02-02-2006, 03:53 AM
database
//maincat
catid
catname
displayorder
//subcat
subid
subname
//photo
photoid
photoname
then i have this script to extract three table's data together
$sql=$db->query("SELECT DISTINCT(b.catid),a.photoid,a.photoname,b.subname,c.catname FROM ".$db_prefix."photo AS a INNER JOIN (".$db_prefix."subcat AS b INNER JOIN ".$db_prefix."cat AS c ON b.catid=c.catid) ON a.subid = b.subid GROUP BY b.catid");
the above query is working, but now the displaying order is according to catid, but i want to according to displayorder, how to do now
//maincat
catid
catname
displayorder
//subcat
subid
subname
//photo
photoid
photoname
then i have this script to extract three table's data together
$sql=$db->query("SELECT DISTINCT(b.catid),a.photoid,a.photoname,b.subname,c.catname FROM ".$db_prefix."photo AS a INNER JOIN (".$db_prefix."subcat AS b INNER JOIN ".$db_prefix."cat AS c ON b.catid=c.catid) ON a.subid = b.subid GROUP BY b.catid");
the above query is working, but now the displaying order is according to catid, but i want to according to displayorder, how to do now