MySQL_Workbench

MySQL 컬럼 합치기, concat, concat_ws

K2ODING 2021. 12. 7. 17:32
728x90

1. concat

select concat(author_fname, author_lname) 
from books;

select concat(author_fname, ' ', author_lname)
from books;
-- ' ' 로 공백 추가 가능

 

2. concat_ws

select concat_ws(' ',aythor_fname, aythor_lname)
from books;
-- ' '로 인해 컬럼사이 공백이 들어감.

' ' 사이에 - 넣었을때