WP Sql custom query

This is a wordpress custom sql query that query a custom post type
<?php $querystr = "
    SELECT p.ID, p.post_title, p.post_content, wpr.object_id, wp_terms.name
FROM wp_terms
INNER JOIN wp_term_taxonomy ON wp_terms.term_id = wp_term_taxonomy.term_id
INNER JOIN wp_term_relationships wpr ON wpr.term_taxonomy_id = wp_term_taxonomy.term_taxonomy_id
INNER JOIN wp_posts p ON p.ID = wpr.object_id
WHERE taxonomy =  'category'
AND p.post_type =  'post'
AND p.post_status =  'publish'
AND name =  'Enter your custom post type here'
ORDER BY object_id
LIMIT 0 , 48
 ";
$pageposts = $wpdb->get_results($querystr, OBJECT);  
echo "<pre>";
print_r($pageposts);
echo "</pre>";
?>