I have two tables from target website in database and have to get post thumbnails rows. One table is wp_posts and another is wp_postmeta. Standard Wordpress export doesn't include featured images so I intended to get it myself. wp_posts contains all posts, and featured image also is a kind of post and stored in this table. wp_postmeta table contains different metadata linked with post id, and value of _thumbnail_id key is the ID of post type 'attachment'. The query below will clarify a little bit what I am trying to say.
Select * From wp_posts
Where ID In (Select meta_value
From wp_postmeta
Where meta_key='_thumbnail_id'
And post_id In (Select ID From wp_posts
Where post_type='$post_type'));
And wp_post contains about 10k rows and wp_postmeta contains about 70k rows. Thanks for all kinda helping. Also will be great if you guys tell me how could I migrate specific post types with thumbnails from one wordpress installation to another.