this should work…
<?php
global $wpdb;
$sql = "SELECT comment_ID FROM ". $wpdb->prefix ."comments WHERE comment_parent = 0 AND comment_ID NOT IN(SELECT comment_parent FROM ". $wpdb->prefix ."comments);";
$results = $wpdb->get_results($sql);
?>
Related Posts:
- Get comment content by comment ID
- Exclude child comments in get_comments() or WP_Comment_Query?
- How can I get a list of comments by target
- custom hooks before a comment is updated/edited in the database
- How to get comment images stored as serialized comment meta
- how to SELECT for the current post id?
- Comment Table Size Results in Slow Page Loads and 500 Errors
- Delete comments function
- Sort post by last commented
- Query comments with non-empty ‘author_url’ value on Admin Comments Screen
- Restrict users to see only own comments and the post author’s replies
- Comments screen in backend, how to disable email address of commenter for non admins
- How can I limit the number of comments per registered user per day?
- wpdb::prepare was called incorrectly
- Parent comment’s author name
- get_comments_number of depth-1 (Level 1) (1 post)
- How can I control the comment counts filtering my CPT replies?
- How to auto-approve internal pingbacks?
- Get total number of comments from posts in a specific custom taxonomy
- Can I store my custom comment_type into wp_comments table?
- Comments waiting but no comments found
- Number of External Links in Comments – Moderation Option
- What is comment_karma?
- How to override function twentyten_comment
- Disqus over the default commenting engine, what are some pros and cons?
- How To Remove The “Click here to cancel reply” Link From The WordPress Comment Form
- Plugin from WordPress.com for comment notification…available? [closed]
- How to add text to comment form #content textarea?
- Enable Recent Comments widget to display comments on attachment posts
- Change allowed HTML tags for comments
- How can I highlight admin comments?
- Why are my comments closed?
- On WordPress 4.4, how to get the post id using the comment_post hook
- Block comments from search engine indexing
- Create a “Reject” action for comments?
- Add action on delete comments?
- Changing “submitted on date” of comments
- Filter custom comment type from Manage Comments & Dash Widgets
- $wpdb query a post type within a specific taxonomy term while ordering posts by custom meta value?
- Can’t seem to get this CSS to work…any ideas why? [closed]
- Change order of comment fields
- WordPress custom form action url
- How to add a strip of visual editor on top of comments textarea
- Threaded comments not working
- Customizing comments pagination for bootstrap
- comment_post action hook running on page load instead of after a comment is posted
- woocommerce allow users to select or use avatar
- How to sort posts by the average of comment meta values
- Error While Sending Comment
- Problem with Comment link in Blog [closed]
- Commenting in user profile page?
- Can i Use own Facebook App ID with this Social Comment Plugin? [closed]
- How to write: $wpdb->update having WHERE NOT value pair in the array
- How do i hide all comments from logged out users
- Only allow the post author and admin to comment on a post
- Show Social Sharing Buttons And Facebook Comments In Lightbox Modal Dialog (Image Overlay)?
- Grant a person permission to moderate all comments on a blog without giving them the ability to edit other peoples post
- How come pending comments are appearing in admin?
- wpdb COALESCE won’t work
- Generate Sub-Comments with WP-CLI [closed]
- comment_date() & comment_time() not working from functions.php
- Repositioning ‘Reply’ Link in Comments
- Add an attachment feature to comments
- Counting Comments as Singular and Plural in comments.php Template
- How to display custom comment fields onto any page
- How to get Post title by locale with Qtranslate-X
- Retrieve the last 5 comment URLs
- WordPress comment for virtual page
- Admin Dashboard – Recent Comments source
- After submit comments select the current tab
- Hide Trackbacks/Pingbaks if none exists
- How to use filter on comment submission/insert
- Comment Pagination
- See some statistics about the comments
- Custom comment types. Are they a possibility?
- How to output comments in Descending order by date using wp_list_comments?
- Re-Direct After Comment Submit IF Comment Comes from Sign-Up Page
- Is there a way to link to the BOTTOM of the comments on a wordpress page?
- Customising the default wordpress search functionality
- Does this archive template part look like its making too many calls to the db?
- Author name length character limit?
- How to fix slow comment query?
- How to pass settings to comment_form() if theme only uses comments_template()?
- Admin – Dashboard – Unset recent comments
- How does WordPress generate a comment website preview?
- Front End User(bloger) turn on and off his comments
- Change comment author after new comment posted
- Show ‘add comment’ link for status updates in Twenty Thirteen
- Pull & display new comments without refreshing the page
- approve,spam,trash etc. options are not coming on comments in admin panel
- Actual comments not showing, but form is?
- Email from new comments
- Image Upload Form is Disabling Comment Addition
- Get comments after specific date
- How do I convert users who put an email and username for a comment into registered users? [duplicate]
- What filter or action to replace comments or add new comment system
- How to stop a specific person to comment on my blog? [closed]
- Auto delete WordPress comments
- update $wpdb one query
- WordPress Editor widgets “comments” and “post comments form” getting disappeared with elementor [closed]