我不能为我的生活弄清楚这个sql语句有什么问题,以及为什么它没有产生任何结果.如果我拿出LEFT JOIN是有效的,那么它有什么问题呢?
SELECT b.id,r.avg_rating FROM items AS b LEFT JOIN ( SELECT avg(rating) as avg_rating FROM ratings GROUP BY item_id ) AS r ON b.id = r.item_id WHERE b.creator = " . $user_id . " AND b.active = 1 AND b.deleted = 0 ORDER BY b.order ASC,b.added DESC
非常感谢帮助.