Click here to Skip to main content
15,892,072 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
I'm trying to concatenate items together with no spaces to create a username for my data output.

Below is the MS ACCESS query that will work in access. What adjustments do I need to add in order for it to run in MySQL? How do you concatenate the first initial, middle initial and last name in SQL. I just recently figured out the CONCAT_WS for creating a full name concatenate as you can see. Should I be using the same CONCAT_WS for the username? If so how do you get it to return the first initials?

SQL
"SELECT 
   			Customers.CustomerID, 
   			Customers.OldCustomerID,
   			CONCAT_WS( ', ',LastName,FirstName,MiddleName) AS CustomerName,


   			Left(FirstName,1)+Left(MiddleName,1)+LastName AS UserName,



   			zlu_Cars.Description AS Car, 
   			zlu_CarColor.Description AS CarColor, 
   			zlu_Computers.Description AS Computer, 
Posted

1 solution

SQL
CONCAT_WS ((Left(FirstName,1)), (Left(MiddleName,1)), LastName) AS UserName,
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900