SQL: Search query to get attachments only of those parents which are published

Well since nobody helped with at first look such an easy problem, i used my way, and if somebody will need it here it is:

I used this query:

$results = $wpdb->get_results(
$wpdb->prepare(
    "select $wpdb->posts.ID,
        $wpdb->posts.post_status,
        $wpdb->posts.post_parent
    from $wpdb->posts
    where post_title like '%%%s%%' and
        (post_type="albumas" OR post_mime_type="audio/mpeg") 
        AND (post_status="inherit" OR post_status="publish")
    $excludes limit 0,".$setting->limit,
    ($setting->search_content == true ? array($name, $name):$name)
));

$results returns me not only post ID but also post_parent so i used condition in my php code

if($result->post_parent > 0)
  $pst = get_post($result->post_parent);

and then i just checked if the parent post is published:

if($pst != null && $pst->post_status =='publish')
{

This is not very optimal version, but because plugin already was using get_post – so i did what i want this way. It would be nice to know how can we do this only via SQL query.