Instead of a sql query, I recommend to do it in wordpress way:
$args = array(
'numberposts' => 3,
'offset' => 0,
'category' => put_your_category_id_here,
'orderby' => 'post_date',
'order' => 'DESC',
'post_type' => 'post',
'post_status' => 'publish',
'suppress_filters' => true );
$request = wp_get_recent_posts( $args, ARRAY_A );
Reference : WordPress
Update : here is the way to get thumbnail url when you have postid
$post_thumbnail_id = get_post_thumbnail_id( $post_id );
if($post_thumbnail_id){
$imageurl = wp_get_attachment_url( $post_thumbnail_id );
}
answer to your last comment :
foreach( $recent_posts as $recent ){
echo '<a href="' . get_permalink($recent["ID"]) . '" rel="bookmark" title="' . $recent["post_title"] . '">
<article>';
$post_thumbnail_id = get_post_thumbnail_id($recent["ID"]);
if($post_thumbnail_id){
$imageurl = wp_get_attachment_url( $post_thumbnail_id );
echo '<img src="' . $imageurl . '" alt="" class="latest-img" >';
}
echo '<img src="' . get_template_directory_uri() .'/img/g.png" class="g" width="667" height="266">
<div class="latest-meta">
<time class="hstack white">DATE</time>
<h2 class="white gstack">' . $recent["post_title"] . '</h2>
</div>
</article>
</a>';
}