columns, rearrange, rename and pivot

Help, please:
I have the table 'orders '.
customer, person, person_code, type, time_sec, month
MILE, John, John1 G, 12, may-2010
MILE, John, John1 G, 2, may 2010
MILE, John, John1 G, 10, may-2010
MILE, John1, John P, 12, may-2010
MILE, John1, John P, 2, may 2010
MILE, John1, John P, 10, may-2010
... and so on

Query
SELECT the customer, person, person_code, type sum (time_sec) time_sec
Orders
Months WHERE = ' may-2010 ".
Customer GROUP, person, person_code, time_sec, type
ORDER BY customer, type asc;

I get:
Customer, person, person_code, type time_sec
MILE, John, John1 G, 24
MILE, John1, John P, 24

How to get reach?
-order of the different columns, names and pivot for type

customer, person, person_code, total_time_sec, sum_type_G, sum_type_P
MILE, John, John1, 48, 24, 24

Help, please.

Hello

The following thread shows basics of pivot:
Help with a query add columns

This example happens to use the COUNT aggregate function. For what you want, use the aggregation MIN (or MAX) and SUM the same way functions.

Published by: Frank Kulash, July 12, 2010 06:41

Tags: Database

Similar Questions

  • Rename and move folders (photo)

    Even though I am the 'administrator', in fact the only user of my computer, I am unable to rename or move the folders that I have pictures in like, apparently, I need "permission". How can I change this? Thank you.

    Go to the main folder (not the shell of the images folder but all folders with images under that - or to a different folder also) and right-click on the folder and click Properties, click the Security tab.  Add you as of right and do not forget to check the box to include all the files and subdirectories.  Click Advanced, and then do the same in the special permissions section in the bottom half.  Then everything in advance, go to the property tab and take ownership of the folder (and new check box to include all the files and subdirectories).  This should give you permission to rename and move the folders as you wish.  The question is why this happened.  I think it has something to do with Windows Media Player or photo gallery and any changes you make here affect things those and perhaps other such programs - but it's your decision to make.  I could start small with just a few pictures and see how it affects everything else before making the biggest changes as the records themselves.

    Just in case, here is some information on the property and an existing one if you are having problems here.

    To view your permissions, right-click on the file/folder, click Properties, and check the Security tab.  Check the permissions you have by clicking on your user name (or group of users).  Here are the types of permissions, you may have:http://windows.microsoft.com/en-US/windows-vista/What-are-permissions.  You must be an administrator or owner to change the permissions (and sometimes, being an administrator or even an owner is not sufficient - there are ways to block access (even if a smart administrator knows these ways and can move them - but usually should not because they did not have access, usually for a very good reason).)  Here's how to change the permissions of folder under Vista:http://www.online-tech-tips.com/windows-vista/set-file-folder-permissions-vista/. To add take and the issuance of right of permissions and ownership in the right click menu (which will make it faster to get once it is configured), see the following article:http://www.mydigitallife.info/2009/05/21/take-and-grant-full-control-permissions-and-ownership-in-windows-7-or-vista-right-click-menu/.

    To solve this problem with folders, folders takeownership or the reader (as an administrator) and give you all the rights.  Right-click on the folder/drive, click Properties, click the Security tab and click on advanced and then click the owner tab.  Click on edit, and then click the name of the person you want to give to the property (you may need to add if it is not there--or maybe yourself). If you want that it applies to subfolders and files in this folder/drive, then check the box to replace the owner of subcontainers and objects, and click OK.  Back and now there is a new owner for files and folders/player who can change the required permissions.  Here is more information on the ownership of a file or a folder:http://www.vistax64.com/tutorials/67717-take-ownership-file.html. To add take ownership in the menu of the right click (which will make it faster to get once it is configured), see the following article:http://www.howtogeek.com/howto/windows-vista/add-take-ownership-to-explorer-right-click-menu-in-vista/.

    I hope this helps.

    Good luck!

    Lorien - MCSA/MCSE/network + / has + - if this post solves your problem, please click the 'Mark as answer' or 'Useful' button at the top of this message. Marking a post as answer, or relatively useful, you help others find the answer more quickly.

  • Maximum number of columns in model RTF Pivot

    HI -.

    For the model previously mentioned here matrix report problem with template RTF - text columns

    I want to restrict the maximum number of columns per page, and the table should be repeated for the rest of the columns in another page.

    For example, if there are 5 columns must be returned, I want the first 3 columns in the first page and the 2 others in a second page (with the hole repeating frame).

    It's for keeping data legible printing of the pdf format, otherwise the data seems damaged and unreadable.

    Y at - it ideas to achieve this requirement?

    Best regards

    Rupture of the horizontal column works fine in the attached version of the RTF model.

  • After scanning in a file, I can't save the PDF file with a unique file name, it will only back up in its original name; Otherwise, if I save the name of the file under a new name, save it box goes outside and the file is renamed and saved. Help!

    If I analyze the file and its original name is:

    Ssrv395alm76439... and I want to rename it "background."

    If I have the rename, the file won't save. If I leave the file as it will save and I have to go to an additional folder and rename it.

    Help, it's too long. I just click on "Save as" and rename and save the document in the necessary folder at a time!

    Hi Allisonchristinele ,

    Please provide the exact point of the software & OS installed on your system. Also check if it is there any update available for the software after crossing "" help > check updates "»

    Follow this thread to reset the Acrobat preferences:- How to reset preference settings in format Acrobat.

    Like 'save' will save the changes with the file & "save under" will give the window using which can save the file to any location on the system.

    I would like to know is what is happening with some or all the files.

    Also, please try to check with the different user account to reproduce the problem.

    Kind regards

    Christian

  • I want to rename and move files from a shoot 5 d. I would like to use the functionality of the increment to count, but since I have to get out of each file to the following file, it starts again at 1. What is the best way to do it?

    I want to rename and move files from a shoot 5 d on a new drive. I would like to use the functionality of the increment to count, but since I have to get out of each file to the following file, it starts again at 1. What is the best way to do it?

    HI -.

    As a prelude to 2014.0, we have added a feature allowing you to choose what number to start the increment of.  Look in the section ingest Rename dialog and change your preset. When you click the button, you should see the option "Custom Auto Increment". This will allow you to choose what number to start on.  We've also added a few newspapers to try to remember where let prelude last successfully interfere the operation by using this option. So, in theory, to remember the number for you. But if it isn't (maybe you want multiple kickoff ingested at the same time) you can always manually set the number to start with.

    Check that out and let me know how it works for you.

    Kind regards

    Michael

  • How can I read a BLOB column with images and write a directory

    Hello

    I have a few paintings with a Blob column, in the columns there are documents (word, excel, images... etc), I have read the column of table and save a directory



    How can I do


    Version 9.2.08

    LS - ltr/bdados3/repser
    ls - ld /bdados3/

    view the results of above OS commands

  • Keep the name of original when file rename and convert to DNG

    In LR 2.6 when I imported my (RAW) images, I would incorporate keeping the original file number, so I would like to batch rename and convert to DNG, once they were already in my catalog.  As I draw from stock, I keep a meticulous care the registry of what I shoot for purposes of metadata and keywords.  I noticed that when I upgraded LR 3, my in my existing catalogs/folders, the original file names are gone and just the new personalized name & sequencing appear. Unfortunately, I still have the Word key & metadata tag many images, but the original numbering in the camera is now missing.  With my new whatever I did to preserve the original numbering, is to import, make my keywords/metadata, and then rename a batch.  However, having to go back is pain, when in the former is LR was easier.  Maybe someone out there knows how to keep both.  It's just easier to check my notes when I have the original of the image number.  Any tips/ideas/suggestions?

    What means Jeff are the display options in the metadata panel here:

    I import, rename and then convert to DNG and as you can see wear the camera file name in the field of origin.

    I don't know why I want as I back up after the name change.

  • How to rename and delete a particular column in a table?

    Hello

    Suppose I have a table with the following defination:

    create table t1
    (a number not null,
    b varchar2 (20).
    c varchar2 (20));

    eventually I want to rename the column b to x and the next step I want to remove column c and all of its contents. How to do this?

    Hello

    To copy the column b: column a

    UPDATE  t2
    SET     b  = a;
    

    To drop a constraint:

    ALTER TABLE  t2
    DROP CONSTRAINT  on_b;
    
  • If a column is renamed which will have impacts to 100 reports?

    Hi gurus,

    I have a column called name Emp and this column is used for 100 reports, now the customer requests as he wants the employee name instead of the name of the Emp and in future also the employee name is fixed.

    So what we need to do should I rename all the name of column reports 100 or any other solution for this?

    Thank you

    VINET

    Open the RPD in online mode and in the presentation layer, the overall consistency check and recharge server metadata, the new name reflected in all reports.

    Check if helps,

    Thank you

  • How to view the line of columns without using the pivot keyword

    Hello
    could someone help me how to display lines in columns without using the keyword pivot and actuall is my scenario, iam having two tables with names and examples of data is shown below

    MIDDLE MINAME TASKID TASKNAME IDENTIFICATION PROJECT

    1 PROJ1 1 AA 100 PR1_TASK1
    1 PROJ1 3 CC PR1_TASK3 102
    1 PROJ1 DD 4 103 PR1_TASK4
    1 PROJ1 EE 5 104 PR1_TASK5
    1 PROJ1 6 105 FF PR1_TASK6
    2 PROJ2 EE 5 114 PR2_TASK1
    2 PROJ2 6 115 FF PR2_TASK2
    2 PROJ2 GG 7 116 PR2_TASK3
    2 PROJ2 HH 8 117 PR2_TASK4
    2 PROJ2 9 118 PR2_TASK5 JJ
    2 PROJ2 KK 10 119 PR2_TASK6
    2 PROJ2 1 AA PR2_TASK7 120


    The output should show the project and County of tasks at a given stage as shown below

    project AA BB CC DD EE FF GG HH JJ KK
    1 2 0 1 5 3 2 0 2 1 0
    2 1 2 0 2 1 0 2 4 3 1


    Thanks in advance,
    VVR
    CREATE TABLE pivot_test (
    ID           NUMBER,
    PROJECT      VARCHAR2(10),
    MID          NUMBER,
    MINAME       VARCHAR2(5),
    TASKID       NUMBER,
    TASKNAME     VARCHAR2(10)
    );
    
    INSERT INTO pivot_test VALUES (1, 'PROJ1', 1,  'AA', 100, 'PR1_TASK1');
    INSERT INTO pivot_test VALUES (1, 'PROJ1', 3,  'CC', 102, 'PR1_TASK3');
    INSERT INTO pivot_test VALUES (1, 'PROJ1', 4,  'DD', 103, 'PR1_TASK4');
    INSERT INTO pivot_test VALUES (1, 'PROJ1', 5,  'EE', 104, 'PR1_TASK5');
    INSERT INTO pivot_test VALUES (1, 'PROJ1', 6,  'FF', 105, 'PR1_TASK6');
    INSERT INTO pivot_test VALUES (2, 'PROJ2', 5,  'EE', 114, 'PR2_TASK1');
    INSERT INTO pivot_test VALUES (2, 'PROJ2', 6,  'FF', 115, 'PR2_TASK2');
    INSERT INTO pivot_test VALUES (2, 'PROJ2', 7,  'GG', 116, 'PR2_TASK3');
    INSERT INTO pivot_test VALUES (2, 'PROJ2', 8,  'HH', 117, 'PR2_TASK4');
    INSERT INTO pivot_test VALUES (2, 'PROJ2', 9,  'JJ', 118, 'PR2_TASK5');
    INSERT INTO pivot_test VALUES (2, 'PROJ2', 10, 'KK', 119, 'PR2_TASK6');
    INSERT INTO pivot_test VALUES (2, 'PROJ2', 1,  'AA', 120, 'PR2_TASK7');
    
    SELECT ID as PROJECT,
           SUM(DECODE(miname, 'AA', 1, 0)) AS AA,
           SUM(DECODE(miname, 'BB', 1, 0)) AS BB,
           SUM(DECODE(miname, 'CC', 1, 0)) AS CC,
           SUM(DECODE(miname, 'DD', 1, 0)) AS DD,
           SUM(DECODE(miname, 'EE', 1, 0)) AS EE,
           SUM(DECODE(miname, 'FF', 1, 0)) AS FF,
           SUM(DECODE(miname, 'GG', 1, 0)) AS GG,
           SUM(DECODE(miname, 'HH', 1, 0)) AS HH,
           SUM(DECODE(miname, 'JJ', 1, 0)) AS JJ,
           SUM(DECODE(miname, 'KK', 1, 0)) AS KK
    FROM   pivot_test
    GROUP BY ID;
    
    PROJECT AA BB CC DD EE FF GG HH JJ KK
    ------- -- -- -- -- -- -- -- -- -- --
          1  1  0  1  1  1  1  0  0  0  0
          2  1  0  0  0  1  1  1  1  1  1 
    
  • MAX value / number of fields and PIVOT

    I run a query against what would essentially be a db (Oracle 10 g) orders. I have 4 tables that I am querrying against.
    It is an abridged version of the result set.
    CUS_ID     ORD_NUM     ACT_IND                                          PRD_ID                                   ORD_COMP_DT
    794102     496342     N - New          1752AOC03GLVVNYXA5MDNRWCNYXA0MW    4/4/2006
    794102     709153     C - Change              1752AOC03GLVVNYXA5MDNRWCNYXA0MW      4/10/2008
    794102     741641     D - Discontinue     1752AOC03GLVVNYXA5MDNRWCNYXA0MW      7/15/2008
    794102     769121     D - Discontinue     1752AOC03GLVVNYXA5MDNRWCNYXA0MW      3/3/2009
    I tried to use the MAX (ORD_COMP_DT) and MAX (ORD_NUM) without success. I always get the same 4 rows returned.
    What I'm trying to accomplish is a result that will show me only the latest information relevant to the CUS_ID (which is unique for each PRD_ID).
    SELECT max(ORD_COMP_DT) as COMP_DT,
    max(ORD_NUM) as ORD
    from table
    My result set would be like:
    CUS_ID        ORD_NUM     ACT_IND                                          PRD_ID                                        ORD_COMP_DT
    794102         769121                 D - Discontinue     1752AOC03GLVVNYXA5MDNRWCNYXA0MW         3/3/2009
    With my limited knowledge, I guess it must be a subquery in my larger query against multiple tables. I looked through the forum and tried using some examples, but always without success.

    Update*-I managed to get the result that is close to what I want just by using the MAX function on ORD_NUM and ORD_COMP_DT and Group BY. However because there are several instances in the ACT_IND column my results exceed 1 line when I include this field. If at this stage, is - can anyone suggest how I can manage this area yet again that the latest ORD_NUM and ORD_COMP_DT?


    Do not confuse the issue, but ultimately I'd like to be able to actually capture New oil fields and stop (PIVOT - I understand is not available on Oracle 10 g, which means another method) and those who, like this pivot:
    CUS_ID         NEW_ORD_NUM     DISC_ORD_NUM     PRD_ID                                                        NEW_ORD_COMP_DT     DISC_ORD_COMP_DT
    794102         496342                     769121                1752AOC03GLVVNYXA5MDNRWCNYXA0MW        4/4/2006                     3/3/2009
    I'm sorry for the post disjointed - I tried to fix my problem before actually hitting the publish button, but I'm stuck.

    Thanks for the research.

    G

    Published by: GMoney on July 12, 2012 11:24

    Published by: GMoney on July 12, 2012 11:27

    Published by: GMoney on July 12, 2012 11:29

    Hello

    GMoney says:

    ...
    create table SR (DOCUMENT_NUMBER VARCHAR(10),
              ORDER_COMPL_DT  VARCHAR(2),
              ACTIVITY_IND VARCHAR(4));
    
    INSERT INTO SR VALUES('12345',to_date('04/04/2006 09:38:08', 'dd/mm/yyyy hh24:mi:ss'),'N');
    INSERT INTO SR VALUES('23456',to_date('10/04/2008 14:21:28', 'dd/mm/yyyy hh24:mi:ss'),'C');
    INSERT INTO SR  VALUES('34567',to_date('15/07/2008 10:14:32', 'dd/mm/yyyy hh24:mi:ss'),'D');
    INSERT INTO SR  VALUES('45678',to_date('03/03/2009 14:55:55', 'dd/mm/yyyy hh24:mi:ss'),'D');
    

    Good; you use correctly TO_DATE.
    Why did you change the data type for irder_compl_dt to VARCHAR (2)?

    Do all the joints, and any other filter you may need, inside the subquery were the ROW_NUMEBR is calculated, if not sooner.
    The main request will do nothing except filter by rn (ROW_NUMBER results) and ORDER BY, if you want to sort the output.

    WITH     got_rn          AS
    (
         SELECT     ck.circuit_design_id
         ,     sr.document_number
         ,     ck.product_id
         ,     sr.activity_ind
         ,     sr.order_compl_dt
         ,     ROW_NUMBER () OVER ( PARTITION BY  ck.circuit_design_id
                                   ORDER BY          sr.document_number     -- or sr.order_compl_dt
                                       DESC
                           ) AS rn
         FROM    ck
         JOIN     src     ON     ck.circuit_design_id     = src.circuit_design_id
         JOIN     sr     ON     src.document_number     = sr.document_number
    --     WHERE     ...     -- If you need other filtering, put it here
    )
    SELECT       circuit_design_id
    ,       document_number
    ,       product_id
    ,       activity_ind
    ,       order_compl_dt
    FROM       got_rn
    WHERE       rn     = 1
    ORDER BY  circuit_design_id     -- if wanted
    ;
    

    If the largest number of document is always order_compl_dts later, then it doesn't matter which of these columns that you use in the ORDER BY clause analytical. Whatever it is, remember to specify DESCending order.

  • Running sum and Pivot Table graphics

    Hello Experts,
    I've shown measures execution of amounts in pivot table problem is when I try to pivotted results graphic I get the original values and not the running sum values. Is there a way to get around this or another way to do?

    Thank you

    Published by: ZaidN on June 29, 2010 07:20

    Do the following things.

    (1) to restart all services

    (2) use the resume function it shows the cumulative graph also

    (3) accumulation of usage view on measure it in pivot does ' t shows resume graphic because the sum of runnung dynamically apply in pivot table, but the table takes the column.

    ...................
    Vincent V

  • It is a must to rebuild requests if the presentation layer columns are renamed?

    It is a must to rebuild requests if the columns on the presentation layer are renowned?

    for example,.
    There is a column called 'market' in the presentation layer.
    and 'market' is used in queries.

    and I rename the 'market' to the "markets" in the presentation layer.
    must I do slip and fall again "markets' demands?

    is there a more clever name?

    Thank you very much!!

    Not necessarily a more clever name, but a smarter way: search + replace via Catalog Manager.

    Search for "display Table". Market
    Replace it with "presentation Table.Markets.

    See you soon,.
    C.

  • Gasoline and pivot table uses in OBIEE

    Hello people,

    Please help understand what PIVOTTABLE DYNAMIC and CALIBER in OBIEE answers
    in what cases or scenario will be used for these things.

    and what is the CASE in OBIEE, where it is used and what is its purpose.

    Thanks in advance

    JMs

    The pivot table view is an interactive view which allows you to rotate the lines, columns and headers to get different perspectives of the data section. PivotTables is navigable and percables and is particularly useful for trend reports.

    Gauges are useful to show the performance against objectives. Gauge types supported include dial and bar style light bulb gauges.

    CASE statement is used for conditions, its use is the case when x = y end doubts... Its similar IF statement in programming.

    -Madan

  • JSPX controls are renamed and getElementById Javascript does not?

    Hi all



    the title kinda sums it up. I have a jspx with some controls on that page. I use the jQuery library to create a modal when popup in a specific container is click on a link, for example,.



    & lt; f: verbatim & gt;

    < div >
    & lt; div id = mySpecialContainer "& gt; < br / > < br / > & lt; an onclick = "ajaxpage ('ajaxContent.html', 'ajaxContent');" "id = 'test' & gt; < br / > < br / > click me < br / > < br / > & lt; /a & gt; < br / > < br / > < br / > & lt; / div & gt; < br / > < / div > < br / > & lt; / f: verbatim & gt; < br / > < br / > < br / > < br / > so in my function javascript I'm referencing mySpecialContainer and it works fine < br / > < br / > < br / > < br / > but now I want to generate a list of items in a database that have the same functionality, see code below, it works so far except that in the rendered source mySpecialContainer has been renamed to something like _id4 : $MyspecialContainer and when the javascript function looking for mySpecialContainer of course it cannot find < br / > < br / > < br / > < br / > < br / > < br / > my fisrt troubleshooting step was just for prelace mySpecialContainer with _id4: $MyspecialContainer in javascript, but I think that the JavaScript off before the page makes the table of course _id4 : $MyspecialContainer does not exist yet and I always get a javascript null exception. < br / > < br / > < br / > < br / > I hope that someone can offer an overview of this issue or a workaround as to how I can get this to work. Another option is if anyone knows how to get a modalDialog with background opacity working with only components of the ADF? < br / > < br / > < br / > < br / > thanks in advance < br / > < br / > < br / > < br / > Jeremy < br / > < br / > < br / > < br / > & lt; AF: id of the table = 'mySpecialContainer"emptyText ="no item found"value =" #{NewsBean.news} "var ="news"& gt;" < br / > < br / > < br / > < br / > & lt; AF:column & gt; < br / > < br / > < br / > < br / > & lt; IMG onclick = "ajaxpage ('ajaxContent.html', 'ajaxContent');" "" src="Images/Layout/EandN.gif" style = "float: left;" margin-right: 10px; "/ & gt; < br / > < br / > < br / > < br / > & lt; / af:column & gt; < br / > < br / > < br / > < br / > & lt; sortable AF:column = "false" & gt; < br / > < br / > < br / > < br / > < br / > < br / > < br / > < br / > & lt; AF:outputText value = "#{news.text}" / & gt; < br / > < br / > < br / > < br / > < br / > < br / > < br / > < br / > & lt; / af:column & gt; < br / > < br / > < br / > < br / > & lt; / AF: table & gt;

    Hello

    You have to mention the version of JDeveloper, you work with. How is built your ID is h:form id: id of the component. So in your case the h:form element does not have a game ID which means its getting created dynamically. Change h:form to have an ID defined value or use af:form. In the first case, the ID of the component becomes form_id:component_id, in the second just component_id case

    Frank

Maybe you are looking for