first column replaced lines

Hi friends,

I have a 13 columns in a report, and it is these columns

Name *) *) q1 *) limit1 *) T2 *) rating2 *) T3 *) Cote3 *) q4 *) rating4 *) suggestion1 *) suggestion2 *) suggestion3 *) suggestion4

For these three columns, I have 10 rows with values as shown below

RESULT - 1
*name----q1----rating1---q2--rating2---q3---rating3---q4---rating4----suggestion1--suggestion2---suggestion3---suggestion4*----------> *headings of the each column*

A-------B-------C-------D----E---------F-----G--------H-----I-------------N----------O--------------P-------------Q
B-------B-------C-------D----E---------F-----G--------H-----I-------------N----------O--------------P-------------Q
C-------B-------C-------D----E---------F-----G--------H-----I-------------N----------O--------------P-------------Q
D-------B-------C-------D----E---------F-----G--------H-----I-------------N----------O--------------P-------------Q
E-------B-------C-------D----E---------F-----G--------H-----I-------------N----------O--------------P-------------Q
F-------B-------C-------D----E---------F-----G--------H-----I-------------N----------O--------------P-------------Q
G-------B-------C-------D----E---------F-----G--------H-----I-------------N----------O--------------P-------------Q
H-------B-------C-------D----E---------F-----G--------H-----I-------------N----------O--------------P-------------Q
I-------B-------C-------D----E---------F-----G--------H-----I-------------N----------O--------------P-------------Q
J-------B-------C-------D----E---------F-----G--------H-----I-------------N----------O--------------P-------------Q
I need to convert the result above down as

RESULTS - 2
*questions-------A-------B---------C---------D--------E-------F-------G-------H--------I-------J*--------------->  *headings of the each column*
B---------------C-------E---------G---------I--------C-------E-------G-------E--------I-------E
suggestion1-----N-------N---------N---------N--------N-------N-------N-------N--------N-------N
D---------------C-------E---------G---------I--------C-------E-------G-------E--------I-------E
suggestion2-----O-------O---------O---------O--------O-------O-------O-------O--------O-------O
F---------------C-------E---------G---------I--------C-------E-------G-------E--------I-------E
suggestion3-----P-------P---------P---------P--------P-------P-------P-------P--------P-------P
H---------------C-------E---------G---------I--------C-------E-------G-------E--------I-------E
suggestion4-----Q-------Q---------Q---------Q--------Q-------Q-------Q-------Q--------Q-------Q
where the appraisal value is - C, E, G, I (4)

where q1, q2, q3, q4 is - B, D, F, H

In the first result above, I had the column as headers (name, q1, limit1, suggestion1... etc).

I need this column to be converted to TITLE and the second column of the result (questions, A, B, C, D, E, F, G, H, I, J)

AND the value of q1, q2, q3, q4 is same as (B, D, F, H)... I need to B, D, F, H, to be a separate line for the first column of 'issues', as shown in result2 as well as suggestion1, suggestion2, suggestion3, suggestion4.

How it is possible to reach the performance(1) to result2. I result1 with me now, how can I able to convert friends result2. Kindly help me with this arrangement with the help of a sorting query.

Simply if we say average, it's like an option "Transpose" in Excel. in which the first column will be replaced by the first row.

Help me with this question friends.

Thank you

Izz all wells
THE GREATER TORONTO AREA.

Published by: GTA on July 1, 2011 08:51

Published by: GTA on July 1, 2011 09:39

Hi GTA.

You're welcome, I'm glad to help you.

Kind regards.

Oscar.

Tags: Database

Similar Questions

  • How remove the line by line by comparing to the first column?

    Hello!

    I have a problem - I need to remove the line by line, but the problem is, I know that the first COLUMN of the table is a PK.
    To retrieve the NAME of the COLUMN that I use:

    SELECT column_name, table_name FROM USER_TAB_COLUMNS WHERE column_id = 1 and table_name = c1.tmp_table_name;
    But it does not somehow.
    Below you can see my script (which has not worked for now):

    declare
    XXX varchar2 (100);
    Start
    C1 in (select table_name, tmp_tables tmp_table_name) loop
    IMMEDIATE EXECUTION
    ' SELECT column_name in ' | xxx | "USER_TAB_COLUMNS WHERE column_id = 1 AND table_name = ' |" ' || C1.tmp_table_name | " ' ;
    immediate execution
    "start."
    for c2 in (select * from ' | c1.tmp_table_name | start loop ')
    Insert into ' | C1.table_name | "values c2; delete from ' | C1.tmp_table_name | 'where ' | xxx |' = c2.' | xxx |'; exception: when other then null; end; end loop; end;';
    end loop;
    end;

    P.S. The Inserts work perfect. I have a problem with deleting lines that are in c1.table_name, of c1.tmp_table_name (the two tables have the same structure, PK, always), because I have the names of columns different another tables which are PK. (for example: K, ID, NS and so on) Please help me to write the correct script.
    For example this will be for the first line recovered as:
    Start
    C1 in (select table_name, tmp_tables tmp_table_name) loop
    immediate execution
    «Start for c2 in (select * from ' |)» C1.tmp_table_name | Start loop ')
    Insert into ' | C1.table_name | "values c2; delete from ' | C1.tmp_table_name: ' where K = c2. K; exception: when other then null; end; end loop; end;';
    end loop;
    end;
    This script works perfectly. But I have many other tables with different PK - K No.

    Solution with the logging of errors table

    -- create the error-logging table
    CREATE TABLE tbl_MergeErrors (
        Stamp       TIMESTAMP(3),
        TableName   VARCHAR2(30),
        KeyColumn   VARCHAR2(30),
        KeyValue    VARCHAR2(4000),
        ErrorCode   NUMBER(5),
        ErrorMsg    VARCHAR2(4000),
    
      CONSTRAINT pk_MergeErrors
          PRIMARY KEY (TableName, Stamp)
          USING INDEX
    )
    /
    
    -- procedure to insert errors
    CREATE OR REPLACE
    PROCEDURE LogMergeError (pTableName  IN VARCHAR2,
                             pKeyColumn  IN VARCHAR2,
                             pKeyValue   IN VARCHAR2)
    IS PRAGMA AUTONOMOUS_TRANSACTION;
    
        -- you couldn't insert SQLCODE or SQLERRM directly into a table (ORA-00984)
        nSQLCODE   NUMBER(5)      := SQLCODE;
        vcSQLERRM  VARCHAR2(4000) := SQLERRM;
    
    BEGIN
      INSERT INTO tbl_MergeErrors
             (Stamp, TableName, KeyColumn, KeyValue, ErrorCode, ErrorMsg)
          VALUES (SYSTIMESTAMP, RTrim( SubStr( pTableName, 1, 30)),
                  RTrim( SubStr( pKeyColumn, 1, 30)), SubStr( pKeyValue, 1, 4000),
                  nSQLCODE, vcSQLERRM);
      COMMIT WORK;
    
    -- if an error occured here, then just roll back the autonomous transaction
    EXCEPTION
      WHEN OTHERS THEN   ROLLBACK WORK;
    END LogMergeError;
    /
    
    -- create the tables and insert test-data
    CREATE TABLE TMP_TABLES (
        TABLE_NAME       VARCHAR2(200),
        TMP_TABLE_NAME   VARCHAR2(200),
      CONSTRAINT TMP_TABLES_X PRIMARY KEY (TABLE_NAME)
    )
    /
    CREATE TABLE TMP_KL002 (
        K   VARCHAR2(40),
        N   VARCHAR2(200)
    )
    /
    CREATE TABLE TMP_TABLE1 (
        NS   VARCHAR2(40),
        N    VARCHAR2(200)
    )
    /
    CREATE TABLE KL002 (
        K VARCHAR2(40),
        N VARCHAR2(200),
      CONSTRAINT PK_KL002 PRIMARY KEY (K)
    )
    /
    CREATE TABLE TABLE1 (
        NS   VARCHAR2(40),
        N    VARCHAR2(200),
      CONSTRAINT PK_TABLE1 PRIMARY KEY (NS)
    )
    / 
    
    INSERT INTO TMP_TABLES (TABLE_NAME, TMP_TABLE_NAME) VALUES ('kl002','tmp_kl002');
    INSERT INTO TMP_TABLES (TABLE_NAME, TMP_TABLE_NAME) VALUES ('table1','tmp_table1');
    INSERT INTO tmp_KL002 (K, N) VALUES ('00', 'none');
    INSERT INTO tmp_KL002 (K, N) VALUES ('07', 'exists');
    INSERT INTO tmp_KL002 (K, N) VALUES ('08', 'not assigned');
    INSERT INTO tmp_table1 (NS, N) VALUES ('2000', 'basic');
    INSERT INTO tmp_table1 (NS, N) VALUES ('3000', 'advanced');
    INSERT INTO tmp_table1 (NS, N) VALUES ('4000', 'custom');
    COMMIT WORK;
    
    -- to test, if it works correct when primary key values exists before
    INSERT INTO KL002 VALUES ('07', 'exists before');
    COMMIT WORK;
    
    -- check the data before execution
    SELECT * FROM TMP_KL002 ORDER BY K;
    SELECT * FROM KL002 ORDER BY K;
    SELECT * FROM TMP_TABLE1 ORDER BY NS;
    SELECT * FROM TABLE1 ORDER BY NS;
    
    -- empty the error-logging table
    TRUNCATE TABLE tbl_MergeErrors DROP STORAGE; 
    
    -- a solution
    DECLARE
    
        PLSQL_BLOCK  CONSTANT VARCHAR2(256) := '
    BEGIN
      FOR rec IN (SELECT * FROM <0>) LOOP
        BEGIN
          INSERT INTO <1> VALUES rec;
          DELETE FROM <0> t WHERE (t.<2> = rec.<2>);
        EXCEPTION
          WHEN OTHERS THEN
              LogMergeError( ''<1>'', ''<2>'', rec.<2>);
        END;
      END LOOP;
    END;';
    
    BEGIN
      FOR tabcol IN (SELECT t.Tmp_Table_Name, t.Table_Name, c.Column_Name
                     FROM Tmp_Tables t,
                          User_Tab_Columns c
                     WHERE     (c.Table_Name = Upper( t.Tmp_Table_Name))
                           AND (c.Column_ID = 1)
                ) LOOP
        EXECUTE IMMEDIATE Replace( Replace( Replace( PLSQL_BLOCK,
                                   '<0>', tabcol.Tmp_Table_Name),
                                   '<1>', tabcol.Table_Name),
                                   '<2>', tabcol.Column_Name);
      END LOOP;
    END;
    / 
    
    -- check the data after execution ...
    SELECT * FROM TMP_KL002 ORDER BY K;
    SELECT * FROM KL002 ORDER BY K;
    SELECT * FROM TMP_TABLE1 ORDER BY NS;
    SELECT * FROM TABLE1 ORDER BY NS;
    
    -- ... and also the error-logging table
    SELECT * FROM tbl_MergeErrors ORDER BY Stamp, TableName;
    
    -- of couse you must issue an COMMIT (the ROLLBACK is only for testing
    ROLLBACK WORK;
    
    -- drop the test-tables
    DROP TABLE TABLE1 PURGE;
    DROP TABLE KL002 PURGE;
    DROP TABLE TMP_TABLE1 PURGE;
    DROP TABLE TMP_KL002 PURGE;
    DROP TABLE TMP_TABLES PURGE;
    
    -- you shouldn't drop the error-logging table, but I use it to free up my db
    DROP TABLE tbl_MergeErrors PURGE;
    

    Greetings, Niels

  • How better to insert a subarray (line) in a 2D array to the correct index which is based on the value of the first column

    Hello

    I would like to insert a subarray (line) in a 2D to the correct index table. The position is to say the index value depends on the value of the first column of the table 2d.

    As an examlple my 2d array would look like this

    230 50 215 255

    300 60 270 330

    360 20 350 370

    And I would like to insert another line (subarray) with the following values

    320 40 300 340

    This new line should be placed between the second and third rows (this is based on the first column only).

    I tried the threshold 1 d function table by taking an 1Dsub array of my 2d array (first column), then using the first of the new line (320) as the threshold. It sort of work, but it does not work when I start the table (IE there is only 1 row) and it seems to not work properly on other occasions (as explained in the help of Labview).

    Hopefully the explanation is clear enough for any suggestion. Thanks in advance for the help!

    JTRI wrote:

    The idea is I have start with a new table and add these lines in the right order every time that the user sets the values Jack

    Ahh, so try this.

    This will also work with an empty array.

    You want to do with this function it is a Subvi.

    Make the entries 'table' and 'subarray"on the connector, then 'new array' output.

    You can then put this Subvi in a loop with a registry to shift and it will help to add new lines in a sorted order, when they are added.

    That is what you were aiming for?

  • Read the data in the first column selected in a multicolumn listbox

    When a line is selected in a ListBox multicolumn (1 point), how can I go on reading the data in the first column?

    The listbox multicolumn itself is the digital picture data type. If you have allowed only 1 point selection and selection mode select any row, it returns the line number. The property node 'Element names' to return a table 2d-chains of the elements in your Inbox. The index of the row to the value of the listbox and column 0. See code attached.

  • Customize the table (first column and the first row)

    Hello everyone, I have a question: How can I insert words and numbers in the same table?

    I have create a VI that measure the temperature with an external instrument and put the data into a table, which is saved.

    Each line is a Thermocouple and each column is a measure, but there are only numbers!
    I would have the first column with the name of the channel and line of fist with the name of the measure.

    I had create an excel for example to explain my wish (Cattura.PNG).

    Thanks to all who help me

    You can insert headers required as column and row to convert it to an array of strings, as in the image below.

  • adding multiple files *.csv while retaining the original file name in the first column

    Hi guys Cela made some time.

    I am trying to add several *.csv files while retaining the original file name in the first column, the real data set is about 40 cases.

    file a.csv contains:
    1, line an a.csv
    2, line 2 in a.csv

    file b.csv contains:
    1, line a b.csv
    2, line 2 in b.csv

    result output.csv is:

    I would like this:
    a.csv, 1, the line in a.csv
    a.csv, 2, line 2 in a.csv
    b.csv, 1, the line in b.csv
    b.csv, 2, line 2 in b.csv

    Any suggestions to speed up my hobbling attempts would be aprieciated

    Thank you

    -SS

    What you could do is given in attachment.

    Started with 2 files:

    a.csv

    copy of a.csv

    Both with data:

  • Freeze first column in IR Apex 5.0.2

    Hello

    I know, the Apex is not MS Excel, but I got a request on my place of work and I am having trouble with this problem.

    I need to freeze the headers (done!) and the first column in the interactive report.

    I used some CSS and I froze the first column, but only lines. The first heading is still moving horizontally.

    This is my demo app: https://apex.oracle.com/pls/apex/f?p=83445:1

    In the Inline CSS for the Page, I set "u - tR {position: absolute ;}"and this has solved that part of the problem above.} "

    Now, I need to fix the first heading that matches the label of this column.

    If anyone knows how to fix the first column using only css and jQuery for IR, I'd appreciate it.

    PS: I apoligize for my skills in English, I'm Brazilian.

    Hi Bruno.

    We can solve this problem by adding the following code to your DA

    $("#stickyTableHeader_2").css("margin", "0px 70px");
    $("#Id").css("margin","0px -70px");
    

    I hope that this action has resolved the problem

    Concerning

    Mahmoud

  • what filter first column by the oracle optimizer

    If anyone can help to understand what filter first column by the optimizer oracle by example below and why?

    Select * from emp where ENAME = 'FORD '.
    AND SAL = 3000;

    Hello

    Look at the MAP of the EXPLAIN command.

    All things being equal, if there is more distinct values of ename, Sal, then it's probably looking for "FORD" first.

    For example, the table has 100,000 rows and there are distinct 10 000 distinct enames and 100 sals, ename and sal are indexed, but there is no combined index.
    If you are looking for by sal firstly, this means that you wait about 1,000 lines of the search index, and then you have to test each of these 1,000 rows for the right ename.
    If you are looking for by ename, first of all, it means that you wait about 10 lines of the search index, and you will only test each of these 10 rows for the sal on the right.
    The order in which the terms were written will count.

    Published by: Frank Kulash, April 2, 2012 07:54

  • How to count the first column automatically.

    Dear all.

    I would like to calculate the first column from 1 to N, when the user clicks on the add a line button.

    Please refer to the following

    -------------------------------------- Code --------------------------------------

    var nNodes is Test_Result1.sub_Product_accessories. Config_Acc.resolveNodes ("Config_Acc [*]"). Length;


    If (nNodes < = 6) {}
    Test_Result1.sub_Product_accessories. Config_Acc.instanceManager.addInstance ();
    }

    AS-IS

    count.JPG

    AS IT WILL BE

    count2.JPG

    Javascript code the Initialize event of the AccNum field:

    this.rawValue = this.parent.index + 1

  • convert a single column in lines

    Hi gurus,

    I have a GBA test table is id and name.

    Identification number
    name varchar2

    data are like

    name identity

    1 xy
    2 xyy
    3 mm
    4 pp

    Now my requirement is to convert the IDs of unique column in lines

    i, e my output should be Singel lines like:-1,2,3,4

    How to achieve this result.

    I have no idea to make this request.

    Please help guys.

    Thanks in advance.

    Vijay

    Oh, wait, now I see:

    I think that with clause will not work in this State

    You have not the clause at all.

    You can omit this part and change t in your own table name
    I only used it to generate sample data.
    That's why I commented :) - query real, based on the id is generated above: in the query, to indicate what is happening ;)

    As Alex has already pointed out:
    You only need the part from the line 7 (first example) or line 10 (second example)

    Hands a great coffee to Alex

  • How to compare one by an element of a column with the first column in the other table?

    Hello

    I have two files into a single file has only Id numbers and the second file has table with for example the column 4, and his first column identification number.

    So I want to compare the first item in the User.ID file with the 1st column all the table file items in this column until it finds matches.

    If compare match then LED will be IT other wise LED will be OFF.

    Here as an attachment, I've attached the two file.

    Please guide me how can I do the same thing.

    Thank you much in advance.


  • How to query the total number of columns and lines filled with data?

    How to get the number of rows and columns in Exel file data using Excel report?

    Since you have posted this question in the forum of LabWindows/CVI, I guess you want to know how to do with CVI.

    You need to know how to open and activate the Excel data file.

    Depending on the function returns the total number of columns and lines col_count row_count, respectively.

    -----------------------------------------------------------------------------------------------------------------------------------------

    int CountColumnsAndRows (void)
    {
    Error HRESULT = 0;
    CAObjHandle rangeCurrentRegionHandle = 0;
    CAObjHandle rangeColumnsHandle = 0;
    CAObjHandle rangeRowsHandle = 0;
      
    unsigned long col_count = 0, row_count = 0;
      
    Must use the 'A1' property and CruuentRegion count the total of columns and lines, including the drafts!
      
    error = CA_VariantSetCString (& MyCellRangeV, 'A1');
      
    error = Excel_WorksheetRange (ExcelWorksheetHandle, NULL, MyCellRangeV, CA_DEFAULT_VAL, & ExcelRangeHandle);
    If (error<0) goto="">
      
    error = Excel_GetProperty (ExcelRangeHandle, & ErrorInfo, Excel_RangeCurrentRegion, CAVT_OBJHANDLE, & rangeCurrentRegionHandle);
    If (error<0)  goto="" error="">
      
    error = Excel_GetProperty (rangeCurrentRegionHandle, & ErrorInfo, Excel_RangeColumns, CAVT_OBJHANDLE, & rangeColumnsHandle);
    If (error<0)  goto="" error="">
      
    error = Excel_GetProperty (rangeColumnsHandle, & ErrorInfo, Excel_RangeCount, CAVT_LONG, & col_count);
    If (error<0) goto="">
      
    error = Excel_GetProperty (rangeCurrentRegionHandle, & ErrorInfo, Excel_RangeRows, CAVT_OBJHANDLE, & rangeRowsHandle);
    If (error<0)  goto="" error="">
      
    error = Excel_GetProperty (rangeRowsHandle, & ErrorInfo, Excel_RangeCount, CAVT_LONG, & row_count);
    If (error<0) goto="">

    Error:

    CA_VariantClear (& MyCellRangeV);
    CA_VariantClear (& MyVariant);
    ClearObjHandle (& ExcelRangeHandle);
    ClearObjHandle (& rangeCurrentRegionHandle);
    ClearObjHandle (& rangeColumnsHandle);
    ClearObjHandle (& rangeRowsHandle);
      
     
    If (error<>
    ReportAppAutomationError (error);
      
    error return;
    }

  • Photosmart Premium C309a print only the first column of the Excel worksheet

    Photosmart Premium C309a print only the first column of the Excel worksheet

    Hello

    I see you are having a problem printing to an Excel document.

    I suggest you install a default substitution such as the jet pilot desktop 990 c driver.

    You can follow this thread of Shane, who will show you how.

    After that, you can try printing again from Excel.

  • Columns of folder: by default, how can return the first column 'Name' without having to move it manually every time?

    Something's happened awhile and when I create a folder which appears the first column is the column 'Date modified '. By default, how can return the first column 'Name' without having to move it manually every time?

    Hello

    I suggest you to visit these links and check if it helps:

    http://Windows.Microsoft.com/en-us/Windows-Vista/working-with-files-and-folders#section_4

    http://Windows.Microsoft.com/en-us/Windows-Vista/folders-frequently-asked-questions

    It will be useful.

  • How the first column heading must be repeated if the table breaks across pages

    Hi Experts,

    RTF model, header row in the table automatically repeat if record go to the next page. in similar fasion, I want to repeat the first column heading, table breaks on any page.

    Please help reslove this issue...

    Hello

    You can add the tag to the first column and the first row of the table. It will repeat 1st column when table to break across pages.

    Here 1 means, repeat first column when table to break across pages.

    I hope this will solve your problem.

    P.S. If you provide 2, this means, repeat for column 2 of the table through the pages

    Please check the issue as resolved, if that answers your question. Thank you

Maybe you are looking for

  • Creation of audit process

    I am running Windows server 2008 R2. Our local security policy requires that we allow the Audit process of creating success. I need to know if there is a way to exclude a particular audit process as it fills up my logs. I'm running a HP6000 EVA contr

  • video on the burned 2 hours 4 minutes long 7,26 GB file to8x 8.5 dvd + r dl lose half recording

    ROXIO VHS to DVD. Video recording 2 h 05 Min 7,76 GB and saved to the file. ToVerbatim recorded 8 x DVD + R DL 8.5 GB 240mins. He played only for about an hour before he cut. Being a surfer of money and enough new to computers I'd appreciate any help

  • THE VIDEO OF MY DROID AND PLAYS UPSIDE DOWN LOAD

    I TOOK A VIDEO ON MY MOTOROLA DROID AND DOWNLOADED ON MY HP WITH THE HELP OF MEDIA PLAYER AND IT PLAYS THE VIDEO IN REVERSE... HOW CAN I CHANGE TO PLAY RIGHT SIDE UP?

  • "Installer is already running.

    I had just taken a new drive for games my wife yesterday. After choosing the game to install and give permission to continue with the installation, a window opens indicating "Installer is already running. I can't go past or around this to install my

  • Cannot start windows vista: bugcheck 9f

    Title: bugcheck 9f, parameters = 0x3, 0xaf5fc030, 0xaf5fc030, 0x84e6c648 my laptop crashed and closed, and I don't know what to do. can someone help me please. yesterday when I turned off my laptop it's ok.but today when I pressed the power button, i