I wish to display the amount of released posts of the category during my wordpress blog. The code is going to be put into the archive.php

Below may be the code I personally use home based. I suppose an adjustment includes the course id in the term taxonomy ( ? )

<?php $numposts = $wpdb->get_var("SELECT COUNT(*) FROM $wpdb->posts WHERE post_status = 'publish' AND post_type = 'post'"); echo number_format($numposts, 0, ',', '.'); ?>