Mysql
 sql >> Datenbank >  >> RDS >> Mysql

Gruppieren Sie mehrere MySQL-Ergebnisse nach einem Spaltenwert

$json_arr = array("movies"=>array());
foreach ($slots as $slot) {
    $json_arr['movies'][$slot["movie_name"]]['movie_name'] = $slot["movie_name"];
    $json_arr['movies'][$slot["movie_name"]]['slots'][] = array (
        "slot_id" => $slot["slot_id"],
        "screen_id" => $slot["screen_id"],
        "time" => $slot["time"],
        "price" => $slot["price"]
    );
}