GROUP BY `class_id` ORDER BY `date`

解决方案 »

  1.   

    最新就
    GROUP BY `class_id` ORDER BY `date` DESC
      

  2.   

    GROUP BY `class_id` ORDER BY `date` DESC LIMIT 0,6
      

  3.   

    $the_ids=array();
    while($row=mysql_fetch_array($result))
    {
    #先输出 这些,或先记下这些
    $the_ids[]=$row['id'];}$the_ids=join(",",$the_ids);$LIMIT=6-count($the_ids);if(count($the_ids))
    {
    $query="SELECT * FROM the_table WHERE id NOT IN ($the_ids) ORDER BY Date DESC LIMIT $LIMIT";
    }else
    {$query="SELECT * FROM the_table WHERE  ORDER BY Date DESC LIMIT $LIMIT";
    }
      

  4.   

    count($the_ids);
    已找到的四条 $LIMIT=6-count($the_ids);
    剩下的2条 $the_ids=join(",",$the_ids); 
    字数组以“,”连接成字符串