1
customer_name restaurant_id visits
shubham 1 4
nayan 2 6
表2
restaurant_id restaurant_name
1 ramon hux
2 Mt.Pete's
質問:3やレストラン名よりも大きいの訪問を持っている顧客の名前を印刷する必要がありますスペースか一重引用符のどちらかがありますか?
私の答え:
select customer_name from table1 where id=(select id from table2
where restaurant_name like "% %" or restaurant_name like "%'%") and visits>3;
問題:サブクエリが1つの以上の行を返します。
どうすればこの問題を回避できますか?あなたのサブクエリが故に以上1つのIDを返すクエリが失敗している
select customer_name from table1 where id IN (select id from table2
where restaurant_name like "% %" or restaurant_name like "%'%") and visits>3;
:
in'代わりに、 '=' 'で使用してください。 –
私に宿題のように見えて匂いがする – RiggsFolly