0

問題が発生したと「思う」が、修正方法がわからない

クエリを整理するための優れた/迅速なヘルプが得られましたが、現在、次のエラーが発生しています: 不明な列 'caet.entity_id' in 'where clause'

エラーは、3 番目の 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
4

1 に答える 1