List:General Discussion« Previous MessageNext Message »
From:Simcha Younger Date:February 3 2011 4:22pm
Subject:Re: Unknown column 'users.users_id' in 'where clause'
View as plain text  
On Thu, 3 Feb 2011 13:55:36 +0000
Tompkins Neil <neil.tompkins@stripped> wrote:

> SELECT DISTINCT(away_teams_id) AS teams_id
> FROM fixtures_results
> WHERE (fixtures_results.away_users_id = *users.users_id*)

> Any ideas why I'm getting Unknown column 'users.users_id' in 'where clause'
> for the part of the statement that I've marked as *bold* and how I can over
> come this problem ?

You have to add the users table to the subquery.
Your subquery only has the fixtures_results table in the 'from' clause, and the subquery
is not aware of the tables you use in the outer query. 

-- 
Simcha Younger <simcha@stripped>
Thread
Unknown column 'users.users_id' in 'where clause'Tompkins Neil3 Feb
  • Re: Unknown column 'users.users_id' in 'where clause'Simcha Younger3 Feb
    • Re: Unknown column 'users.users_id' in 'where clause'Tompkins Neil4 Feb