Last active
June 3, 2020 21:21
-
-
Save chadidi/381fd23ea6b8ae5676a32b9273fa1348 to your computer and use it in GitHub Desktop.
posts without eager loads and appends
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[2020-06-03 21:20:43] local.INFO: select posts.*, count(likes.id) + count(comments.id) as total_count from `posts` left join `likes` on `posts`.`id` = `likes`.`likable_id` and `likes`.`likable_type` = ? left join `comments` on `posts`.`id` = `comments`.`commentable_id` and `comments`.`commentable_type` = ? where `posts`.`deleted_at` is null group by `posts`.`id` order by `total_count` desc ["posts","posts"] |
Author
chadidi
commented
Jun 3, 2020
•
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment