select t1.table1 from table1 as t1
where t1.column1
in
(
select t2.column2 from table2 as t2
join
table3 as t3 on t2.column1=t3.column1
where t3.columnx=5
);
上記は、私が起動しているmysqlクエリです。サブクエリテーブルからのデータも必要でした。
たとえば、テーブル t2 の columnxy とします。
失敗するクエリ
select t1.table1,t2.columnxy from table1 as t1
where t1.column1
in
(
select t2.column2 from table2 as t2
join
table3 as t3 on t2.column1=t3.column1
where t3.columnx=5
);
外側のクエリを選択してそれらを追加すると、意味のある「不明な列」というエラーが発生します。
正しい方法ですか、それとも結合を使用してクエリを書き直す必要がありますか?