Re: derived select can't find table

2007-12-27 Thread Baron Schwartz
Hi,

On Dec 26, 2007 11:02 PM, wang shuming <[EMAIL PROTECTED]> wrote:
> Hi,
>   select * , ( select f2
>   from (select f1,f2 from t2 where t2.id=t1.id limit 1 union
> all ...  order by f1  ) t2
>   limit 1
>  )  f2
>from t1
>  Unknown column ' t1.id' in 'where clause'
>
> Best regard!
> Shuming Wang
>

Read this page:
http://dev.mysql.com/doc/refman/5.0/en/subquery-restrictions.html

"Subqueries in the FROM clause cannot be correlated subqueries. They
are materialized (executed to produce a result set) before evaluating
the outer query, so they cannot be evaluated per row of the outer
query."

-- 
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]



derived select can't find table

2007-12-26 Thread wang shuming
Hi,
  select * , ( select f2
  from (select f1,f2 from t2 where t2.id=t1.id limit 1 union
all ...  order by f1  ) t2
  limit 1
 )  f2
   from t1
 Unknown column ' t1.id' in 'where clause'

Best regard!
Shuming Wang