select `tbl_users`.`username`, `tbl_users`.`users_id`, `tbl_users`.`profile_picture`,
(select count(users_id) from tbl_movies_comments where users_id = `tbl_users`.`users_id`) as UsersCommentsCount,
(select count(users_id) from tbl_movies_reviews where users_id = `tbl_users`.`users_id`) as UserReviewsCount
left join `tbl_movies_comments` on `tbl_users`.`users_id` = `tbl_movies_comments`.`users_id`
left join `tbl_movies_reviews` on `tbl_users`.`users_id` = `tbl_movies_reviews`.`users_id`
group by `tbl_users`.`username`, `tbl_users`.`users_id`, `tbl_users`.`profile_picture`, `tbl_movies_comments`.`users_id`, `tbl_movies_reviews`.`users_id`
2条答案
按热度按时间uklbhaso1#
你的陈述格式很糟糕。这就是为什么很难调试代码。。。
使用诸如heidisql或联机语法格式化程序/检查器之类的工具来避免这种情况
5hcedyr02#
查询中没有from子句。