خطای پایگاهدادهٔ وردپرس : [Unknown column 'wc_product_meta_lookup.stock_status' in 'order clause']SELECT SQL_CALC_FOUND_ROWS ss_posts.ID
FROM ss_posts LEFT JOIN ss_term_relationships ON (ss_posts.ID = ss_term_relationships.object_id) INNER JOIN ss_postmeta ON ( ss_posts.ID = ss_postmeta.post_id ) LEFT JOIN ss_wc_product_meta_lookup AS hello_wc_lookup ON (ss_posts.ID = hello_wc_lookup.product_id) LEFT JOIN ss_postmeta AS pardis_regular ON (ss_posts.ID = pardis_regular.post_id AND pardis_regular.meta_key = '_regular_price')
WHERE 1=1 AND (
ss_posts.ID NOT IN (
SELECT object_id
FROM ss_term_relationships
WHERE term_taxonomy_id IN (32372)
)
AND
ss_term_relationships.term_taxonomy_id IN (5479)
) AND (
ss_postmeta.meta_key = '_sale_price'
) AND ((ss_posts.post_type = 'product' AND (ss_posts.post_status = 'publish')))
GROUP BY ss_posts.ID
ORDER BY
CASE
WHEN (wc_product_meta_lookup.stock_status = 'instock' OR wc_product_meta_lookup.stock_status IS NULL OR wc_product_meta_lookup.stock_status = '')
AND wc_product_meta_lookup.min_price IS NOT NULL AND wc_product_meta_lookup.min_price > 0 THEN 0
WHEN wc_product_meta_lookup.stock_status = 'instock' OR wc_product_meta_lookup.stock_status IS NULL OR wc_product_meta_lookup.stock_status = '' THEN 1
WHEN wc_product_meta_lookup.stock_status = 'outofstock' THEN 2
ELSE 1
END ASC
, CASE
WHEN CAST(pardis_regular.meta_value AS DECIMAL(20,4)) > 0
AND CAST(hello_wc_lookup.min_price AS DECIMAL(20,4)) > 0
AND CAST(pardis_regular.meta_value AS DECIMAL(20,4)) > CAST(hello_wc_lookup.min_price AS DECIMAL(20,4))
THEN ((CAST(pardis_regular.meta_value AS DECIMAL(20,4)) - CAST(hello_wc_lookup.min_price AS DECIMAL(20,4))) / CAST(pardis_regular.meta_value AS DECIMAL(20,4)))
ELSE 0
END DESC, ss_posts.ID DESC
LIMIT 0, 30