0

message, sender, to, timeI want group by sender と order by time this is my codeを含むテーブルを作成しました

$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

では、その問題を解決するにはどうすればよいでしょうか。

ありがとう
クラウス

4

3 に答える 3

2

優先順位に注意してください。結果がグループ化されたら、順序付けする必要があります。

"SELECT * FROM  `table`  GROUP BY `sender` ORDER BY `time`"
于 2013-07-01T00:15:11.043 に答える