Page 1 of 1

Unknown Column

Posted: Sat Oct 06, 2007 4:40 pm
by kendall

Code: Select all

SELECT
  Website, 
  Requirement, 
  State, 
  Date, 
  Month, 
  Year, 
  CollegeName AS College, 
  AdID, 
  Association, 
  college_vacancies.Position, 
  college_vacancies.Sport, 
  DATE_FORMAT(Date,'%%a %%D %%b %%y') AS TheDate, 
  Sex, State 
FROM 
  college_vacancies, 
  colleges_list 
RIGHT JOIN 
  students_information AS student 
ON 
  student.Position = college_vacancies.Position 
WHERE 
  college_vacancies.CollegeID = colleges_list.CollegeID 
  AND college_vacancies.Sport = student.Sport 
  AND college_vacancies.Position = student.Position 
  AND Gender = Sex AND student.STUDENTID = %s 
  AND college_vacancies.`Status` = 1 
ORDER BY 
  Date DESC, 
  Association
The above statement should bring up the vacancies whose Sport and Position match those in the students. However in trying to execute the statement i get a
Unknown column 'college_vacancies.Position' in 'on clause'
I'm not sure whats wrong as the column exists :?: :?:

Jcart | Much easier to read the query now isn't it? Please post long queries in a formatted fashion in the future please.

Posted: Sat Oct 06, 2007 7:37 pm
by califdon
Try removing the parentheses in the "on" clause. They're not required, and possibly they are not being parsed correctly.

Posted: Sun Oct 07, 2007 8:16 am
by feyd
If ~califdon's suggestion doesn't help much, can you post "SHOW CREATE TABLE foo" outputs for the tables?

Also, it would help to see your SELECT query formatted for reading.