db query for retrieving comments without any reply

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);
?>

error code: 523