Consider the following table:
I am using the query below (in SQL Server) to convert this table to a flat table as follows:
I would like to the same thing using Oracle SQL. However the query does not work in "Oracle SQL" language: cross apply
, which is used below, does not work in Oracle. Any idea how to write this equivalently using Oracle SQL? Thanks!
select t.employee_id,
t.employee_name,
c.data,
c.old,
c.new
from test_table t
cross apply
(
select 'Address', Address_Old, Address_new union all
select 'Income', cast(income_old as varchar(15)), cast(income_new as varchar(15))
) c (data, old, new)