SELECT SQL_CALC_FOUND_ROWS  wp_posts.*
			FROM wp_posts  LEFT JOIN wp_term_relationships ON (wp_posts.ID = wp_term_relationships.object_id) INNER JOIN wp_postmeta ON ( wp_posts.ID = wp_postmeta.post_id ) LEFT JOIN wp_wc_product_meta_lookup wc_product_meta_lookup ON wp_posts.ID = wc_product_meta_lookup.product_id  LEFT JOIN (SELECT * FROM wp_postmeta WHERE meta_key = '_sale_price' AND meta_value > 0) sale ON (wp_posts.ID = sale.post_id)  LEFT JOIN (SELECT * FROM wp_postmeta WHERE meta_key = '_stock_status') stock ON (wp_posts.ID = stock.post_id) 
			WHERE 1=1  AND ( 
  wp_posts.ID NOT IN (
				SELECT object_id
				FROM wp_term_relationships
				WHERE term_taxonomy_id IN (7)
			) 
  AND 
  wp_term_relationships.term_taxonomy_id IN (937)
) AND ( 
  wp_postmeta.meta_key = '_price'
) AND ((wp_posts.post_type = 'product' AND (wp_posts.post_status = 'publish' OR wp_posts.post_status = 'acf-disabled' OR wp_posts.post_status = 'wc-fraud-screen' OR wp_posts.post_status = 'wc-authorised')))
			GROUP BY wp_posts.ID
			ORDER BY  stock.meta_value ASC, sale.meta_value DESC,  wc_product_meta_lookup.min_price ASC, wc_product_meta_lookup.product_id ASC 
			LIMIT 0, 11200
		

Chris Jenkins

WordPress database error: [You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near ') AND meta_key = 'select_maker') ORDER BY SUBSTRING_INDEX( post_title, ' ', -1 )' at line 1]
select * from wp_posts WHERE id in (select DISTINCT meta_value from wp_posts p inner join wp_postmeta pm on p.ID = pm.post_id WHERE post_id IN () AND meta_key = 'select_maker') ORDER BY SUBSTRING_INDEX( post_title, ' ', -1 )

No products were found matching your selection.