I'm trying to find all orders with a status of 'failed'

Each query works individually but when I use one as a subquery it fails.

```
 SELECT wp_posts.*
        FROM wp_postmeta
        INNER JOIN wp_posts
        ON wp_postmeta.post_id = wp_posts.ID
        AND wp_posts.post_type='shop_order'
        AND wp_posts.post_status='publish'
        AND wp_posts.post_date>='{$this->carbon->now()->subDays($days)->toDateTimeString()}'
        AND wp_postmeta.meta_key='_customer_user'
        AND wp_postmeta.meta_value='{$this->user->ID}'
        IN (SELECT DISTINCT wp_postmeta.post_id, tt.taxonomy, te.slug 
        FROM wp_postmeta, wp_terms te, wp_term_relationships tr, wp_term_taxonomy tt
          WHERE wp_postmeta.post_id = tr.object_id
          AND tr.term_taxonomy_id = tt.term_taxonomy_id
          AND te.term_id = tt.term_id
          AND tt.taxonomy = 'shop_order_status'
          AND te.slug = 'failed'
        )

```

I'm pretty new to sql, so i think the subquery is wrong. Does the subquery even make sense? I'm looking for posts with those conditions and then making another query to find those posts with a te.slug value of 'failed'

Thanks for any guidance.