Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Spaces With MAX

Status
Not open for further replies.

PCHomepage

Programmer
Feb 24, 2009
609
US
I never uses spaces in column names but I have a dataset now that I did not generate so I have no control over the structure and it has spaces. I am trying to query the table and generally when there is a space in the name I simply tic the name: `column name`. When using MAX(), though MySQL protests and gives only an error. I tried single-quotes but then it just returns the text within the quotes rather than the values in the columns. Any ideas? A sample is below.

Code:
SELECT MAX(FileID) AS FileID, 
	MAX('A param') AS A_param, 
	MAX('C0 param') AS C0_param, 
	MAX('u0 param') AS u0_param, 
	MAX('Ba param') AS Ba_param,
..... etc.
 
With the ticks, it simply said that there was no such column name. I've already gone past it so no longer have the exact error message available by deciding that I would run a query first to add underscores in place of the spaces for this test, then reprogram the function that insert the data from incoming CSV files to add it automatically from now on.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top