mysql - 在sql查询中连接属性

标签 mysql sql

我想使用 MySQL 在 select 语句中加入一些属性

SELECT 
        (Cast(n_socio As varchar), ' - ', nombre, ' ', apellidos) As DisplayItem,
        N_socio 
FROM     
        usuarios 
ORDER BY 
        n_socio

最佳答案

您缺少 CONCAT 函数。

SELECT 
        CONCAT(Cast(n_socio As varchar), ' - ', nombre, ' ', apellidos) As DisplayItem,
        N_socio 
FROM     
        usuarios 
ORDER BY 
        n_socio

关于mysql - 在sql查询中连接属性,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/24821052/

相关文章:

php - mysql表更新没有结果

php - mysql 在 while 语句中没有更新

mysql - 导出数据转义换行不起作用

mysql - MySQL中存储几乎相同的4个字段的最佳方式

sql - 如何覆盖 SQL 中的 row_number 值?

mysql - 将选定记录从 MySQL 数据库导出到 SQLite 数据库需要哪些命令?

mysql - 同时选择计数/求和和真/假位标志

MySQL:使用表中的parent_id获取所有层次结构

MySQL 从与表名的连接返回字段和数据?

mysql - Visual Studio for Mac 的数据库设置