Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR SQL

multiple left join mysql

SELECT news.id, users.username, news.title, news.date, news.body, COUNT(comments.id)
FROM news
LEFT JOIN users
ON news.user_id = users.id
LEFT JOIN comments
ON comments.news_id = news.id
GROUP BY news.id
 
PREVIOUS NEXT
Tagged: #multiple #left #join #mysql
ADD COMMENT
Topic
Name
5+7 =