I am using SQL Query to get the \_sku of product.
and this is my Query. But i am getting NULL in response.
Can anyone point out what am i missing?
Basically using this way i could get any product meta with the order details.

```
select 
p.ID as order_id, 
p.post_date, 
max( CASE WHEN pm.meta_key = '_billing_email' and p.ID = pm.post_id THEN pm.meta_value END ) as billing_email,
max( CASE WHEN oim.meta_key = '_product_id' and oim.order_item_id = oi.order_item_id  THEN oim.meta_value END ) as product_id,
max( CASE WHEN pm.meta_key = '_sku' and p.ID = oim.meta_value THEN pm.meta_value END ) as sku,
( select group_concat( order_item_name separator '|' ) from wp_woocommerce_order_items where order_id = p.ID ) as order_items
from 
wp_posts p
join wp_postmeta pm on p.ID = pm.post_id
join wp_woocommerce_order_items oi on p.ID = oi.order_id
join wp_woocommerce_order_itemmeta oim on oim.order_item_id = oi.order_item_id
group by 
p.ID

```