Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

Bellow is my table structure wp_woocommerce_order_itemmeta

meta_id order_item_id  meta_key        VALUE
    1     2            Dining Date      2014-10-22
    2     2            Booking Time     3:00 - 5:00
    3     2            _qty             1
    4     2            _product_id      226
    5     2            pa_gender        male
    6     2            Dining Date      2014-10-22
    7     2            Booking Time     3:00 - 5:00
    8     2            _qty             1
    9     2            _product_id      226
    10    2              pa_gender       female

I am using bellow query but i am getting only column names. But not getting specific record.of meta_key and meta_values.

SELECT t1.*
FROM wp_woocommerce_order_itemmeta t1
INNER JOIN wp_woocommerce_order_itemmeta t2 ON t1.meta_key='_product_id'=t2.meta_key='_product_id'  
WHERE t1.meta_key = 'Dining Date' AND t1.meta_value = '2014-10-22'
  AND t1.meta_key = 'Booking Time' AND t2.meta_value = '3:00 - 5:00'
  AND t1.meta_key = '_product_id' AND t2.meta_value = '226'
  AND t1.meta_key = 'pa_gender' AND t2.meta_value = 'female'
  AND t1.meta_key = 'pa_gender' AND t2.meta_value = 'male';
share|improve this question

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Browse other questions tagged or ask your own question.