shepmom2002 Posted October 19, 2010 Share Posted October 19, 2010 I am brand new to mySQL, I have used MS SQL in the past. I have written a select query in Access and the query is working perfectly. When I try to re-create the query in MySQL I am getting errors all over the place. I'm sure it is something with my syntax, but I am having trouble figuring out what I am doing wrong. I am using MySQL client version: 5.0.51a. Here is my query: SELECT Customers.CustomerID, Customers.OldCustomerID, Concat(Customers.LastName,',',Customers.FirstName, ' ', Customers.MiddleName) AS Customer Name, Concat(Left(Customers.FirstName,1), Left(Customers.MiddleName,1), Customers.LastName) AS Username, zlu_Cars.Description AS Car, zlu_CarColor.Description AS Car Color, zlu_Computers.Description AS Computer, Customers.IsLaptop AS Laptop, zlu_Race.Description AS Race, zlu_Residence.Description AS Residence, zlu_BirthMonth.Description AS Birth Month FROM (((((Customers INNER JOIN zlu_BirthMonth ON Customers.BirthMonthID = zlu_BirthMonth.BirthMonthID) INNER JOIN zlu_CarColor ON Customers.CarColorID = zlu_CarColor.CarColorID) INNER JOIN zlu_Cars ON Customers.CarID = zlu_Cars.CarID) INNER JOIN zlu_Computers ON Customers.ComputerID = zlu_Computers.ComputerID) INNER JOIN zlu_Race ON Customers.RaceID = zlu_Race.RaceID) INNER JOIN zlu_Residence ON Customers.ResidenceID = zlu_Residence.ResidenceID ORDER BY Customers.LastName, Customers.FirstName; Here is the error I am receiving: #1064 - You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'Name, Concat(Left(Customers.FirstName,1), Left(Customers.MiddleName,1), Customer' at line 1 Can anyone help?? Quote Link to comment https://forums.phpfreaks.com/topic/216262-new-to-mysql-problems-with-query-statement/ Share on other sites More sharing options...
Pikachu2000 Posted October 19, 2010 Share Posted October 19, 2010 AS Customer Name, <-- remove the space, or add underscore, etc. CustomerName, Customer_Name Quote Link to comment https://forums.phpfreaks.com/topic/216262-new-to-mysql-problems-with-query-statement/#findComment-1123879 Share on other sites More sharing options...
shepmom2002 Posted October 19, 2010 Author Share Posted October 19, 2010 Thank you, putting the underscore in worked!!! Quote Link to comment https://forums.phpfreaks.com/topic/216262-new-to-mysql-problems-with-query-statement/#findComment-1123884 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.