Use Select statement so that multiple columns appear in only one

2

Using MySQL, I try to select, for example, the name surname 1 and surname 2, everything appears in the same column with the name Full name.

I have tried to solve it using the following but when executing it the results are displayed at 0 or null.

select nomem + ' - ' + ape1em + ' - ' + ape2em 'Nombre completo' from empleados ;

    
asked by Darckan 24.01.2018 в 18:19
source

2 answers

1

greetings

use the CONCAT function of mysql to concatenate your fields

link

example SELECT CONCAT("SQL ", "Tutorial ", "is ", "fun!") AS ConcatenatedString;

good morning

    
answered by 24.01.2018 / 18:22
source
2

You can use the CONCAT_WS()

SELECT CONCAT_WS(' - ',nomem,ape1em,ape2em) NombreCompleto
FROM empleados;
    
answered by 24.01.2018 в 18:24