开发者

why mysql query is failing

开发者 https://www.devze.com 2023-02-27 03:59 出处:网络
mysql> select name,family from member 开发者_高级运维as d where mov in(select d.mov from d);
mysql> select name,family from member 开发者_高级运维as d 
 where mov in(select d.mov from d);        

.

ERROR 1146 (42S02): Table 'film.d' doesn't exist 


d in your subquery (select d.mov from d) is not a valid table name. Are you trying to do some kind of correlated query with the member table by using the alias d here?


mysql is looking for table d which is definitely does not exists.

select name,family from member d 
 where mov in(select d.mov from member d);  

d is not valid because you can not use alias of outer query to inner query (sub query). You have to redefine the alias for table in sub query.


Ignoring the fact that the query doesn't actually do anything besides select all rows in the member table, the reason it isn't working is that you cannot use an outside alias 'd' inside your subquery. Try this:

SELECT name, family FROM member WHERE mov in (SELECT mov from member)
0

精彩评论

暂无评论...
验证码 换一张
取 消