下面的查询将每个模型与其相关的照片相匹配,并让我回显 10 个帖子,其中照片中的第一张图像作为帖子的默认图像。虽然它工作正常,但它似乎真的很慢。有没有更快的方法来达到预期的结果?
"SELECT * "
. "FROM models a "
. "INNER JOIN models_images b ON a.model_id = b.model_id "
. "WHERE 1 AND `images_ok` = '1'"
. "GROUP BY a.model_id ORDER BY a.id DESC "
. "LIMIT 10"
谢谢