我有以下表结构:
Time_Stamp Number
9/07/13 234
9/07/13 345
9/07/13 456
10/07/13 765
10/07/13 834
10/07/13 257
我想像这样打印它:
9/07/13 234 345 456
10/07/13 765 834 257
知道我该怎么做吗?
编辑:
这就是我目前打印行的方式:
if(!$result_db_post = $db->query($query)){
die('There was an error running the query [' . $db->error . ']');
}
while($row = $result_db_post->fetch_assoc()){
echo $row['time_stamp'] ." ". $row['number'];
echo "<br />";
}
这导致此输出:
9/07/13 234
9/07/13 345
9/07/13 456
10/07/13 765
10/07/13 834
10/07/13 257
我已经尝试了这两个查询,并且都产生了相同的输出。
select Time_Stamp, group_concat(Number separator ' ') as Numbers
from t
group by Time_Stamp;
我也试过:
SELECT Time_Stamp, GROUP_CONCAT(Number) From table group by Time_Stamp
知道我做错了什么吗?