Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- SELECT base.nid AS nid, coalesce(count(distinct comments.cid), 0) + coalesce(count(replies.cid), 0) AS comments
- FROM
- {node} base
- LEFT JOIN {comment_field_data} comments ON comments.entity_type = 'node' AND base.nid = comments.entity_id AND comments.status = 1
- LEFT JOIN {comment_field_data} replies ON replies.entity_type = 'comment' AND comments.cid = replies.entity_id AND replies.status = 1
- WHERE base.type = :db_condition_placeholder_0
- GROUP BY base.nid, comments.cid, replies.cid
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement