] [SQL query field splicing learning record []

[SQL] record what problems and solutions encountered today

Demand : Some fields require a data check out the escape and then stitching.
Solution :
1, two field splicing methods:

CONCAT(A.NAME, B.CODE) AS CON;

If there is a fixed value, the fixed value plus quotes:

CONCAT(A.NAME, '次'));

2, conditional escape

CASE A.RUN_STATUS 
	WHEN 'RUNNING' 
		THEN '运行' 
	WHEN 'NOT_RUN' 
		THEN '非运行' 
	ELSE A.RUN_STATUS
		END 
	AS 巡视说明

3, the escape of air, for example: if it is assigned a null value

NVL(A.CYCLE_NUMBER, 1);

Here Insert Picture Description

Published 14 original articles · won praise 1 · views 261

Guess you like

Origin blog.csdn.net/qq_39938236/article/details/103244612