Skip to content
Advertisement

Query DB Laravel

I’m trying to count the post count of each tag, then orderBy by the post count. But there was a problem when counting the number of posts: tags with no posts were not displayed. I want if any tag has no post, it will still be printed. What should I do.

Advertisement

Answer

you can use LeftJoin to show all rows from left table that doing join:

User contributions licensed under: CC BY-SA
2 People found this is helpful
Advertisement