-- DB Checks -- select * from vProducts where 1 = 1 and product_type = 'simple' and pm_manage_stock != 'no' and (pm_stock_status != 'instock' and coalesce(pm_stock, 0) > 0); select count(*) as chk from wp1_posts where post_status not in (select post_status from m4m_refOrderStates) and post_type = 'shop_order'; select id, pmd.post_title, pmd.pm_price, pm_regular_price from vProductMetaData pmd join vProducts vp on vp.wp_post_id = pmd.id where coalesce(pmd.pm_price,0 ) <> coalesce (pmd.pm_regular_price,0) and product_type = 'simple';