Jump to content

New to mySQL, problems with query statement


shepmom2002

Recommended Posts

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??

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.