如何在Magento 1.9中使用WHERE子句加入TABLES

时间:2018-06-01 11:36:07

标签: join magento-1.9 jointable

我想加入两个表, customer_entity customer_entity_varchar ,但我不知道该怎么做。这是我目前的查询:

假设我entity_id是5而attribute_id是139

SELECT attribute_id, entity_id FROM customer_entity 
INNER JOIN customer_entity_varchar ON customer_entity.entity_id = customer_entity_varchar.entity_id 
WHERE customer_entity.entity_id = 5 AND customer_entity_varchar.attribute_id = 139

以下是我想要实现的查询。

for(i=n-1;i>=0;i--){
    while(W!=0){
        if(W>=w[i]){
            W=W-w[i];
            money=money+val[i];
            w[i]=0;

        }else{
            money=money+(float)(W*(val[i]/w[i]));
            w[i]=w[i]-(W*(val[i]/w[i]));
            W=0;
        }}}
    printf("\n%f",money);

我坚持这个。我正在使用Magento 1.9

0 个答案:

没有答案