如何将SELECT语句中的数值变量转换为字符变量(MySQL)
How to convert a numeric variable to a character variable in SELECT statement (MySQL)
SELECT *
variable1,
variable2,
variable3,
variable4
FROM table
我想将 variable1 从数字变量转换为字符变量,我正在尝试以下选项:
SELECT *
variable1 AS CHAR(variable1),
variable2,
variable3,
variable4
FROM table
我正在尝试其他代码:
SELECT *
variable1 AS CONVERT(variable1, CHAR),
variable2,
variable3,
variable4
FROM table
但这似乎不是正确的语法。
有什么想法吗?
SELECT
CONVERT(variable1,CHAR) AS variable1,
variable2,
variable3,
variable4
FROM table
SELECT *
variable1,
variable2,
variable3,
variable4
FROM table
我想将 variable1 从数字变量转换为字符变量,我正在尝试以下选项:
SELECT *
variable1 AS CHAR(variable1),
variable2,
variable3,
variable4
FROM table
我正在尝试其他代码:
SELECT *
variable1 AS CONVERT(variable1, CHAR),
variable2,
variable3,
variable4
FROM table
但这似乎不是正确的语法。
有什么想法吗?
SELECT
CONVERT(variable1,CHAR) AS variable1,
variable2,
variable3,
variable4
FROM table