我“认为”我看到了这个问题,但不知道如何解决它
得到了一些很好/快速的帮助来理顺我的查询,但现在我收到了这个错误: 'where子句'中的未知列'caet.entity_id'
错误出现在第三个 select 语句中。我想说>>选择caev.entity_id字段匹配caet.entity_id的值。我检查过,拼写正确,并且这些字段在两个表中。
这应该工作,我需要另一个加入吗?
select c.*,
(
select caet.value
from customer_address_entity_text caet
where cae.entity_id = caet.value_id
and caet.attribute_id = 23
) as test,
(
select caev.value
from customer_address_entity_varchar caev
where caet.entity_id = caev.entity_id
and caev.attribute_id = 23
) as two
from customer_entity c
join customer_address_entity cae on c.`entity_id` = cae.`parent_id`
where store_id = 15
下面的查询显示了我尝试过的内部连接,但仍然出现错误:
select c.*,
(
select caet.value
from customer_address_entity_text caet
where cae.entity_id = caet.value_id
and caet.attribute_id = 23
) as test,
(
select caev.value
from customer_address_entity_varchar caev
where caet.entity_id = caev.entity_id
and caev.attribute_id = 23
) as two
from customer_entity c
join customer_address_entity cae on c.`entity_id` = cae.`parent_id`
INNER JOIN customer_address_entity_text CAET ON CAET.id = CAEV.id
where store_id = 8