Planet MySQL Planet MySQL: Meta Deutsch Español Français Italiano 日本語 Русский Português 中文
Showing entries 1 to 1

Displaying posts with tag: pivot tables (reset)

Oracle 11g: New Pivot Table Feature
+0 Vote Up -0Vote Down

I was very pleased when I heard about Oracle adding pivot functionality in select statements. Finally — we wouldn’t have to copy the data to a spreadsheet or code a ton of sum(case when col1 = 'X' then amount else 0 end) total_X for each column we would want to display.

I am basically looking for three things in a pivot-style query:

  • the ability to specify which column will be pivoted as one or more columns in the resulting query
  • row subtotals
  • column subtotals
  • The first item is the only one that really matters. I can work around the other two, so let’s get started.

    Create a test table with a few rows:

    create table bob_pivot_test( id number, cost number, tx_date date, product_type varchar2(50));
    insert into bob_pivot_test values (1,10.99,sysdate-10,'Toy');
    insert into bob_pivot_test values
      [Read more...]
    Showing entries 1 to 1

    Planet MySQL © 1995, 2014, Oracle Corporation and/or its affiliates   Legal Policies | Your Privacy Rights | Terms of Use

    Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.