query specific posts according their custom fields, using sql SELECT

You should be able to do this with WP_Query‘s meta_query parameters:

$type="something";
$programme="another";

$args = array(
    'meta_query' => array(
        array(
            'key' => 'type',
            'value' => $type,
            'compare' => '='
        ),
        array(
            'key' => 'programme',
            'value' => $programme,
            'compare' => 'LIKE'
        )
    )
);
$query = new WP_Query( $args );