Hàm CONCAT_WS() của MySQL
Ví dụ
Thêm nhiều biểu thức lại với nhau và thêm dấu phân cách "-" giữa chúng:
SELECT CONCAT_WS("-", "SQL", "Tutorial", "is", "fun!") AS ConcatenatedString;
Hãy tự mình thử »Định nghĩa và cách sử dụng
Hàm CONCAT_WS() thêm hai hoặc nhiều biểu thức cùng với dấu phân cách.
Lưu ý: Ngoài ra hãy xem hàm CONCAT() .
Cú pháp
CONCAT_WS( separator , expression1 , expression2 , expression3 ,...)
Giá trị tham số
Parameter | Description |
---|---|
separator | Required. The separator to add between each of the expressions. If separator is NULL, this function returns NULL |
expression1, expression2, expression3, etc. |
Required. The expressions to add together. An expression with a NULL value will be skipped |
Chi tiết kỹ thuật
Hoạt động trong: | Từ MySQL 4.0 |
---|
Thêm ví dụ
Ví dụ
Thêm ba cột (và thêm khoảng trắng giữa chúng) vào một cột "Địa chỉ":
SELECT CONCAT_WS(" ", Address, PostalCode, City) AS Address
FROM
Customers;
Hãy tự mình thử »