Export Posts with specific custom fields by sql

Hi The tables that you need to consider is

wp_posts – Which contains all the details about the posts.
wp_postmeta – Which is used to store the meta details for a post with relation to post_id.

Query will be

Select * FROM wp_posts a, wp_postmeta b WHERE a.post_status="published" AND a.post_id = b.post_id AND b.meta_key = 'Your Custom Field';

wp_terms, wp_term_relationships contains the terms and tags which is related to a particular post.

wp_terms – tag details.
wp_term_relationships – how each term is related to a particular post. (object_id = post_id)

Cheers Happy Coding.