You would do that kind of thing in the client application displaying the results
Kate Albany
Junior Poster in Training
71 posts since Jun 2005
Reputation Points: 10
Solved Threads: 1
Well if you must do it in SQL and not the front-end, this is how I would do it in Oracle:
select 'Work', 'Work' from dual
union all
select 'Code', 'Nature' from dual
union all
select work_code, work_nature
from sb_cm_work_nature
The table 'dual' in Oracle is a fake table you can use to select manual values from the DB. For instance to get the system date you would do the following:
select sysdate from dual
I know there is an equlivant to Oracle's 'dual' table in MS SQL, but I do not know what it is called.
Though you may have problems if the 'work_code' column is stored as a numerical field, as the columns joined by a 'union all' must be of the same datatype. As you can see the values of 'Work' & 'Code' selected from dual are strings and unless 'work_code' from sb_cm_work_nature is also a string you will have to do something ugly like this:
select 'Work', 'Work' from dual
union all
select 'Code', 'Nature' from dual
union all
select to_char(work_code), work_nature
from sb_cm_work_nature
Hope that helps,
Kate
Kate Albany
Junior Poster in Training
71 posts since Jun 2005
Reputation Points: 10
Solved Threads: 1