How to delete all unpublished commands on Drupal using sql

DELETE c, rcb, dcb
    comment AS c
JOIN field_revision_comment_body AS rcb ON (c.cid = rcb.entity_id)
JOIN field_data_comment_body AS dcb ON (rcb.entity_id = dcb.entity_id)
    c. STATUS = 0


DELETE FROM field_data_comment_body USING field_data_comment_body JOIN comment ON comment.cid=field_data_comment_body.entity_id AND comment.status=0
DELETE FROM field_revision_comment_body USING field_revision_comment_body JOIN comment ON comment.cid=field_revision_comment_body.entity_id AND comment.status=0
DELETE FROM comment WHERE status=0

Leave a Reply

Your email address will not be published. Required fields are marked *

Need Help With Code?