List:General Discussion« Previous MessageNext Message »
From:Roger Baklund Date:September 19 2005 1:54am
Subject:Re: 1064 error
View as plain text  
Schalk Neethling wrote:
> Greetings
> 
> What might be causing the 1064 error in the following query?
> 
> SELECT mem_number, first_name, last_name, area_represented,
> joining_points + E-Model Challenge + SA Pro Model + Star Model Challenge 
> + Eastern Cape Classic + SA Model Super Star + KZN Model GP + Mpumalanga 
> GP + Glam Slam Model Challenge + Model Man Woman + SA Look of the Year + 
> SA Face of the Year + KZN Classic + Eastern Cape GP + Western Cape 
> Classic + Free State Classic + North West GP + Northern Province Classic 
> + SA Model Open + Cover Search + Champion of Champions + Northern Cape 
> Classic + Goldfields Model GP + Limpopo Classic + SA Model Portfolio + 
> Top Model Challenge + Gauteng Model Classic + Year of the Model AS 
> total_points
> FROM modelcup.ab_leader_board
> 
> All of the rows does exist in the table and all row names are correct. 

"row names" ?

You seem to be selecting data from a table called ab_leader_board in a 
database called modelcup. Some of the fields/columns in the table seems 
to be mem_number, first_name, last_name, area_represented and 
joining_points, but then it gets unclear... what does the next part 
mean:  joining_points + E-Model Challenge +

MySQL will interpret this as "...joining_points pluss E minus Model AS 
Challenge pluss..." and give a syntax error. (The 'AS' alias keyword is 
optional.)

You can't use + for concatination, if that is what you are trying to do.

If you have columns named "E-Model Challenge", "SA Pro Model" and so on, 
and you want to add the numeric value of all these columns into one 
column named "total_points", you must use `backticks` because of the 
spaces in the names:

   joining_points + `E-Model Challenge` + `SA Pro Model` + ...

<URL: http://dev.mysql.com/doc/mysql/en/legal-names.html >

-- 
Roger

Thread
1064 errorSchalk Neethling19 Sep
  • Re: 1064 errorRoger Baklund19 Sep
    • Re: 1064 errorSchalk19 Sep
  • Re: 1064 errorRory McKinley19 Sep