How to query blogs posts of WordPress sub domain?

You’re probably going to have to write some custom SQL for that. Here’s an example function that would do this. It’s slightly insecure as we can’t use $wpdb->prepare to put the blog_id in (it surrounds anything inserted with quotes).

<?php
function wpse33779_get_posts_from_blog( $blog_id = 1 )
{
    // is this is the current blog, just get posts...
    if( 1 === $blog_id )
    {
        return get_posts();
    }
    else 
    {
        // make sure this is a number.
        $blog_id = absint( $blog_id );
    }

    // did absint kill our blog id?
    if( ! $blog_id ) return array();

    global $wpdb;
    $a = $wpdb->prepare( "SELECT * from {$wpdb->base_prefix}{$blog_id}_posts WHERE 'post' = post_type AND 'publish' = post_status" );
    $posts = $wpdb->get_results( $a );
    return $posts;
}

I’m not good at writing SQL, but you get the idea. You could flesh that function out to be as full featured as get_posts as well.

You could also use switch_to_blog

<?php
switch_to_blog( $blod_id );
$posts = get_posts();
// do stuff with posts
restore_current_blog();

That said, switch_to_blog is probably not a great idea. It’s really slow.