Trying to get specific orders by the customer ID via a raw SQL query. I'd like to input which order IDs I'd like to retrieve, but only retrieve them if they match a specific customer ID, here's what I have so far:
SELECT *
FROM wp_postmeta
WHERE post_id IN ($order_ids)
AND (meta_key='_customer_user' AND meta_value='$user_id')
I've read some things similar but nothing doing exactly as I need it to.
Any help would be greatly appreciated. Thanks in advance.