Try this: select DEPT||" "||CRS||SC as new from table
combine fields to make new field sql
-
18-03-2022 - |
문제
I have these three fields that I'd like to combine to make one new one:
DEPT CRS SC
-------------
BIO 101 A
BIO 101 B
BIO 105 A
CHEM 101 A
Preferred output:
NEW
-------------
BIO 101A
BIO 101B
BIO 105A
CHEM 101A
I have a feeling I would use NVL()?
해결책
다른 팁
You could try with this query
SELECT A.DEPT, A.CRS || A.SC AS NEWCOLUMN
FROM YOURTABLE A
You could also create a view to make it easier to use in the future.
CREATE VIEW SUMMARY AS
SELECT DEPT || ' ' || CRS || SC AS NEWCOL
FROM YOURTABLE;
제휴하지 않습니다 StackOverflow