SQL query add only posts with custom field to array

Why don’t you just do:

<?php 
global $post;
$args = array( 
    'post_type' => 'post',
    'post_status' = 'publish',
    'posts_per_page' => '10',
    'meta_query' => array(
        array(
            'key' => 'fruit',
            'value' => 'apple'
        )
    )
);
$custom_query = new WP_Query( $args );
while( $custom_query->have_posts() ): $custom_query->the_post(); ?>

<?php the_title(); ?>

<?php endwhile; wp_reset_query(); ?>