我创建了一个表,其中包含message, sender, to, time
我想要按发件人分组并按时间排序这是我的代码
$query= mysql_query("SELECT * FROM `table` ORDER BY `time` GROUP BY `sender`")or die(mysql_error());
while($arr = mysql_fetch_array($query)){
$num = mysql_num_rows($query);
$msg = $arr ['message'];
echo '</br>';
echo $msg;
}
这向我显示了这个错误
You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'GROUP BY
发件人' at line 1
那么如何解决这个问题呢?
谢谢克劳斯
_