wpdb custom post_type problem

If you’re trying to get all meta values for a key within a specific post type, you can do something like this in a single query:

SELECT post_id, meta_value FROM $wpdb->postmeta pm, $wpdb->posts p
WHERE meta_key = 'sd_rating' and pm.post_id = p.ID  AND p.post_type="cpu"