PHPで次のクエリがあります。
$stmt = $conn->prepare('SELECT
date,
avg(sells) as sells
FROM `table` WHERE product_id = :id group by date having count(id) > 1');
$stmt->execute(array('id' => $product));
$res = $stmt->fetchAll(PDO::FETCH_ASSOC);
予想通り、これは私を返します:
array(2) {
[0]=> array(2) {
["date"]=> "2013-1-11" ["sells"]=> "73.5000"
}
[1]=> array(2) {
["date"]=> "2013-1-11" ["sells"]=> "77.0000"
}
}
とにかく、phpでループせずに次の出力を取得できますか?
array(2) {
[0]=> array(2) {
"2013-1-11",
"73.5000"
}
[1]=> array(2) {
"2013-1-11",
"77.0000"
}
}