Try this: select DEPT||" "||CRS||SC as new from table
combine fields to make new field sql
-
18-03-2022 - |
Question
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()?
Solution
OTHER TIPS
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;
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow