barney75
asked on
Combining 2 columns as one ?
Hello
I am hoping that there is some way in SQL to combine the values of 2 columns into one in the ResultSet. Can you tell me if this is can be done?
Teachers
teacher class
-------------------------
Mr Doyle Math
Supervisors
supervisor class
-------------------------- -
Mr Reid Math
I want to display the following:
class teachers
-------------------------- ------
Math Mr Doyle, Mr Reid
Any suggestions?
I am hoping that there is some way in SQL to combine the values of 2 columns into one in the ResultSet. Can you tell me if this is can be done?
Teachers
teacher class
-------------------------
Mr Doyle Math
Supervisors
supervisor class
--------------------------
Mr Reid Math
I want to display the following:
class teachers
--------------------------
Math Mr Doyle, Mr Reid
Any suggestions?
SELECT dbo.Supervisors.class, RTRIM(dbo.Teachers.teacher ) + ', ' + dbo.Supervisors.supervisor AS Teacher FROM dbo.Supervisors INNER JOIN dbo.Teachers ON dbo.Supervisors.class = dbo.Teachers.class
select T.class , T.teacher + ',' + s.supervisor as teachers
from supervisor S , Teachers T
from supervisor S , Teachers T
ASKER
On both of those - "ORA-01722 - invalid number". I am using an oracle db by the way...
Don't know oracle, but since the error say's invalid number it probably aspected numbers in the columns. Try to replace the + with &
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Thank you SjoerdvW, the || did the trick!