这是一个mysql请求:
$requete1 = mysql_query("
SELECT a.post_id, e.meta_value
FROM wp_postmeta as b
INNER JOIN wp_postmeta AS a ON b.post_id = a.post_id
INNER JOIN wp_postmeta AS d ON b.post_id = d.post_id
INNER JOIN wp_postmeta AS e ON b.post_id = e.post_id
WHERE b.meta_key = '_show_hide_sales'
AND b.meta_value = '1'
AND d.meta_key = '_sold_sales'
AND d.meta_value != '3'
AND e.meta_key = '_sales_sort_number'
ORDER BY CAST(e.meta_value as UNSIGNED INTEGER) DESC
LIMIT ".($from-1).", ".($range+1)
);
while($resultat1 = mysql_fetch_array($requete1))
{
$res2= $resultat1['post_id']; // this one is ok
$res3= $resultat1['meta_value']; // this one is ambiguous
};
对post_id($ res2)的搜索是可以的,因为它是明确的。
但这里有三个可能的meta_key:
但是如何获得与" _sales_sort_number"相关的meta_value($ res3)? meta_key?
我的SELECT清楚地表明我想要检索应该与" _sales_sort_number"相关联的 e.meta_value 。 meta_key但它似乎没有用。
感谢您的指导。