Transpose a table using Oracle SQL -


I have some data in a table that I want to use SQL Here sample data is table test_pivot (name varchar2 (100), department varar2 (50), dipty varchar2 (50), dippy varchar2 (50), section varchar2 (50)); All Entry (name, DeptA, DeptB, DeptC, DeptD) values ​​('ashpul', 'y', 'null') in test_pivot (name, department, DPTB, DPTC, DPTD) values ​​('devimalia') , Tap, tap). (Name, department, department, DPTC, DTT, NALL, Y, Knol, department) value (name, department, DPTB, DPTC, DPTA) value ('Rangan', zero, zero, 'Y', null) Select '1' from Dual to 'Santanu', tap, zero, zero, 'Y');

I want the data to show below.

Enter image details here

I have a hard time finding it, please tell me.

Here is a SELECT statement without PIVOT and UNPIVOT. As you can see, it is much more complicated:

  Selection department, NVL (max (case when name = 'impossible' then dept_val end), 'n') asfakul, nvl ( Max (in case when the name = 'debamalya' then DEPT_ALL AND), 'N' as the form of delimitation, NVO (max (case when name = 'dyeing' then deputy_val and, 'N') In the case of Ranjan, NVL (maximum (when the name = 'Santanau' then 'dept_val end', 'N'), select the name, department, case, when depta = 'depta'] then depta when dept = ' Deptb 'then deptb when dept =' deptc ' B deptc When dept = 'detached' then connect DPTD end to DEPT_ test_pivot (select 'DEPTA' as dual federation from dual union) Select all selection 'DPTB' as dual federation from Dual Union 'DTPTC' From the department, select 'DipTi' as double-decked department) 1 = 1) By the order of the department by the department  

Comments

Popular posts from this blog

java - Can't add JTree to JPanel of a JInternalFrame -

javascript - data.match(var) not working it seems -

javascript - How can I pause a jQuery .each() loop, while waiting for user input? -