'How to convert a numeric variable to a character variable in SELECT statement (MySQL)

SELECT *
   variable1,
   variable2,
   variable3,
   variable4
FROM table

I wanna transform the variable1 from a numeric variable to a character variable, and I'm trying this options:

SELECT *
   variable1 AS CHAR(variable1),
   variable2,
   variable3,
   variable4
FROM table

And I'm trying this other code:

SELECT *
   variable1 AS CONVERT(variable1, CHAR),
   variable2,
   variable3,
   variable4
FROM table

But it seems that's not the correct syntax.

Any idea?



Solution 1:[1]

SELECT 
   CONVERT(variable1,CHAR) AS variable1,
   variable2,
   variable3,
   variable4
FROM table

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1