我有以下查询
select
tab1.post_id,
((tab1.meta_value - tab2.meta_value) / tab1.meta_value) * 100 as discount
from
fridaysunday.wp_postmeta as tab1,
fridaysunday.wp_postmeta as tab2
where
tab1.post_id = tab2.post_id and tab1.meta_key = 'price' and tab2.meta_key = 'sale_price'
order by discount desc;
我想将此查询与 WP_Query 函数集成。非常感谢您的帮助,在此先感谢!