ich habe eine sql abfrage mit der ich einige Infos aus 2 tabellen auslese zusätzlich dazu wollte ich jetzt aus einer 3 tabelle in der bewertungsergebnisse gespeichert sind den durchschnitt dieser auslesen:
Code: Alles auswählen
$sql = "SELECT *, AVG(r.rate_point) as rating
FROM " . ALBUM_TABLE . " a
LEFT JOIN " .ALBUM_CAT_TABLE ." ac ON ac.cat_id = a.pic_cat_id
LEFT JOIN " . ALBUM_RATE_TABLE . " r ON r.rate_pic_id = a.pic_id
WHERE a.pic_id = $pic_id
ORDER BY $order_by
LIMIT " . $start . ", " . $board_config['topics_per_page'];
Hat jemand ne idee wie ich das richtig hinbekommen kann??SQL Error : 1140 Mixing of GROUP columns (MIN(),MAX(),COUNT()...) with no GROUP columns is illegal if there is no GROUP BY clause
SELECT *, AVG(r.rate_point) as rating FROM phpbb_album a LEFT JOIN phpbb_album_cat ac ON ac.cat_id = a.pic_cat_id LEFT JOIN phpbb_album_rate r ON r.rate_pic_id = a.pic_id WHERE a.pic_id = 4 ORDER BY a.pic_username DESC LIMIT 0, 5
Grüße Candy