I have two custom post types, type1 and type2. Type2 posts have a postmeta called postID that is the ID number of a post in type1. When showing type1 in single.php I want a mysql query that selects the type2 post.
The only data I have is the ID number of type1. So I have to select from type2 postmeta where the meta_key = postID and the meta_value = type1 ID. I then need to use the post_id of that row to select the post from wp_posts.
I'm not good with forming mysql queries, so is there a single query that will do this?