exclude pingbacks from wordpress SQL query

You can achieve this by excluding pingback from the comment_type column of wordpress comments table

$query = "select
           wp_posts.*,
           coalesce((
           select
              max(comment_date)
           from
              $wpdb->comments wpc
           where
              wpc.comment_post_id = wp_posts.id
              AND comment_approved = 1
              AND post_password = ''
              AND comment_type NOT IN ( 'pingback' )
          ),
           wp_posts.post_date  ) as mcomment_date
        from
           $wpdb->posts wp_posts
        where
           post_type="post"
           and post_status="publish"
           and comment_count > '0'
        order by
   mcomment_date desc  limit $limit";