why mysql query is failing

103 views Asked by At
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 
3

There are 3 answers

3
Joe Stefanelli On

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?

1
Shakti Singh On

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.

0
Jeff Swensen On

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)