Hi Sinans11,
Don’t forget to check if the post is published. (post_status = publish).
Unless of course you really want 10 posts regardless if it is published or not. =)
I use the following guery to get posts under a specific category. I got it by googling, and just added the $cat variable to hold the category id number, instead of defining it in the query. This way I can change the category id dynamically, while using the same query for different categories I want.
$tp = $wpdb->prefix; //-- the table prefix "wp_" etc.
$cat = 8; //-- id of the category
$cat_query = $wpdb->get_results("SELECT * FROM $wpdb->posts WHERE post_type = 'post' AND post_status = 'publish' AND ID IN (Select object_id FROM {$tp}term_relationships, {$tp}terms WHERE {$tp}term_relationships.term_taxonomy_id =$cat) ORDER BY post_date DESC");