Skip to content
Advertisement

Truncate a column that is the result of CONCAT function?

I’m trying to truncate a column that I have created in my query to display only 15 characters, however I don’t know how to. In a table (yes), in a query (no).

How would I write my code to do this? Here’s the code:

(SELECT CONCAT(StudLName, ',',UPPER(StudFName)) AS StudentName FROM STUDENT);

Current result:

result

Advertisement

Answer

I think this is what you want:

(SELECT LEFT(CONCAT(StudLName, ',',UPPER(StudFName)),15) AS StudentName FROM STUDENT);
User contributions licensed under: CC BY-SA
3 People found this is helpful
Advertisement