String concatenation when remembering MySQL query

need:

SELECT name, store_type from pigcms_salesev_store 

Original content

According to the different store_type in the table, add the identifier after the name

0: 'Store'
1: 'Warehouse

SQL statement

SELECT 
Concat(name,'【',CASE store_type WHEN 0 THEN '门店' WHEN 1 THEN '仓库' END,'】') as store_name 
from store 

renderings

renderings

Concat() concatenates strings, that is, connects multiple strings to form a longer string.

Concat() requires one or more specified strings, separated by commas.

Guess you like

Origin blog.csdn.net/Depressiom/article/details/123108964