Cases in the Group of cluses

I need to group of cases with sub query is possible
/*******************************************************************************/
Select
segment3,

(case when segment3 as 210% ' and segment4 in (select child_m from apps.) XXNBE_PAR_PROD) and then (select parent_m from apps. (XXNBE_PAR_PROD where segment4 = child_m) else ' ' end) AS PC,.

Sum (br_egp) IN_BR_EGP

from apps. XXNBE_FIN_R7 R7

Group

segment3

, (case when segment3 as 210% ' and segment4 in (select child_m from apps.) XXNBE_PAR_PROD) and then (select parent_m from apps. (XXNBE_PAR_PROD where segment4 = child_m) else ' ' end);

/*******************************************************************************/
It is not not allowed here to Returne the error subquery expressions

You cannot use subqueries in Group of. Try this


select a.segment3,
       case when a.segment3 like '210%' and
                 b.child_m is not null
            then b.parent_m
    else ' '
       end as pc
  from app.XXNBE_FIN_R7 a
  left
  join apps.XXNBE_PAR_PROD b
    on a.segement4 = b.child_m
group
    by a.segment3,
       case when a.segment3 like '210%' and
                 b.child_m is not null
            then b.parent_m
    else ' '
       end 

Tags: Database

Similar Questions

  • During a group text why don't I see all the answers of the Group

    I have an Iphone 6. I get no answers from everyone in a group text and others in the Group text.  Is it a setting on my phone or others. There are Iphone and Android users in the text of the group.

    If you go to settings > Messages > have you enabled e-mail group and MMS? If this is not the case, this may explain why you don't see the answers of Android users.

  • Support for the 'grouping' Dual LAN

    I bought a router of WRT600N, which was far & away the router wireless dual band to use more expensive (& only) available at the time + 2 compatible Ultra Range Plus USB receivers.  Apparently Linsys/Cisco decided to abandon this model & more support - still firmware version 1.0 (from 2008).  OK, then repeat ceMarketing not high on their priorities.

    I recently upgraded my hardware in a platform Intel 1156 running Win 7 Ultimate 64-bit completely.  The new motherboard, a Gigabyte GA-P55-UD5, has a 'dual LAN' support that allows "bundling" - potentially 2 GB support & self-switching if a port is not functional.  Apparently, it requires a router that has 'IEEE 802.3ad' capabilities.  As far as I can tell, this potentially interesting feature only is not supported, & the firmware upgrade failure suggests it will be never. - bought their "Network Magic" software Pro to add another $50.

    So the question is this: I believe - no double support LAN is built in & never will be--or is there a way to use this feature?  Suffice to say, if I paid about $420 for the router & USB receivers where if other router support him on the level of consumption, I will never consider a Linksys/Cisco product in this life.

    Thanks for some clarity - that someone has to offer.

    I would say the associations are no consumer router function. If you really need a connection of 2 Gbps to a single device to your network, I wonder what other device to communicate with this speed. It is not only another device because it would have only 1 GB/s unless you team two remaining ports as well. (Do not forget that desktop computers more level of consumption are not yet fast enough to offer or receive data at a rate even if they have a Gigabit ethernet port).

    If you have a set of other features which, in combination, require 2 Gb/s access server, then you will have again the same problem: it must connect somewhere which means you need a switch that must be connected to the two remaining LAN ports. But then, you might as well get a switch that supports reunification and enough ports and connect everything what he. Of course, an ethernet switch that supports the grouping is usually some 'smart' managed switch that cost easily more then your WRT600N.

    So I think that grouping will be never supported on any Linksys consumer device. If you then you must watch the Cisco Small Business series or better. They have some devices supporting 802. 1 q VLAN and therefore potentially also 802.3ad. Although even in this case I doubt because given the number of ports available on these devices is not really a lot of sense to support at least on a router 4 ports. Devices consumer and SOHO are not for internet connections of 1 Gbit/s or more. So you can only use the speed inside the LAN, but with 4 ports that would be difficult... So I would say that by their design these routers don't support grouping. If you need grouping within your LAN, get a managed switch...

  • Having hard time you sign in to one account on my computer. "The group policy service does not have log on." Access denied. "

    Trying to connect to one of the accounts on my computer and the message telling me "the group policy service does not have the journal on.»  Access denied. "  Can someone help me with this?

    Hello

    1. is the computer connected to a network domain?

    2 are you facing this problem into account administrator? Do you have other administrator accounts enabled in the computer?

    3 did you changes to the computer before the show?

     
     
    Method 1:

    Check if you are able to start the computer in safe mode.
     
    Step 1: Safe Mode

    Start your computer in safe mode and check the number.

    To start your computer in safe mode

    http://Windows.Microsoft.com/en-us/Windows-Vista/start-your-computer-in-safe-mode

     
    If you are unable to boot into safe mode, please let us know.

    Step 2:

    You run the system restore in Windows recovery environment?

    If this isn't the case, I would say you can do a system restore to the Windows recovery environment. Follow the steps in the section provided.

    http://support.Microsoft.com/kb/940765/en-us


     
    I hope this helps!
  • Windows 7 Edition home premium error "Windows cannot connect to the Group Policy client service."

    Original title: guest for Windows 7 Home Premium account

    Hi all

    I would like to aid which has had to face the problem below and how it was fixed.

    I have Window 7 Edition home premium and created a guest account with normal privileges that is turned on but cannot access with the error "Windows could not connect to the Group Policy client service" I think that the main problem is related to a policy because when put on the account to administer it in pop, error message says 'Cannot connect to a windows service' Please check group policy log.

    Thank you very much in advance

    Hello

    Thank you for your time and effort to get back to us, and I apologize for the delay in responding.

    Method 1 step number d makes reference to the present Details tab on the event viewer, where you can get the details of the error. First, search for the error which will be something like Windows cannot process extension Client Strategy Group-side and click on the error and then click the Details tab and make a note of the GUID (Globally Unique Identifier) for the extension defective client-side. For reference, see the screenshot:

    Now come to step f number , it indicates the location of the Group Policy Extensions so that you can check if the extensions shown in the case log and the Registry Editor extension have a difference. The path of the GPExtension is HKEY_LOCAL_MACHINE\Software\Microsoft\Windows NT\CurrentVersion\Winlogon\GPExtensions. For reference, see the screenshot:

    Let us know if the steps are clear to understand now. If this isn't the case, we will be happy to help you further.

    Thank you.

  • ISE 1.3.0.876 - cannot delete the Group of network devices

    Hello

    When I try to delete a NDG I tells me "this node cannot remove because it contains devices or subgroups.

    When I search in the peripheral topic network no devices are part of the group, and it has no sub-groups in this group.

    So what don't understand me?

    Brian

    Hi Brian,.

    If you have checked everything regarding the configuration and we are still not able to remove the NDG group.

    In this scenario, that the problem is although the n group is not referenced for an any Nagels when we try to delete the n group, it will throw an error "this node cannot remove because it contains devices or subgroups.

    The reason for this problem is that previously when n use this group of n, and if we reference out of this group of n, "dereferenced" information only are not updated in the database table and thus causing the issue when deleting GUI. He still thinks as if it has references.

    You may need to open a TAC case for this because it will be access to the SQL DB of the ISE and you don't have access to him.

    Kind regards

    Aditya

  • GETVPN and regeneration of the keys when several members of the Group leave at the same time

    He did not specify how the key servers respond when several members of the group start simultaneously. For example, if 3 members leave the same group, made the key manager sends three keys (KEK, TEK) and only the last will be available for future connections? Or the key manager optimizes the regeneration of the keys and sends only a single key?

    Thank you

    Stone,

    On himself, he is not uncertain. You can retrieve the session memory keys (not impossible but difficult).

    I guess what you are looking for is a red button to clear the SAs on all devices?

    In this case:

    http://www.Cisco.com/en/us/docs/iOS-XML/iOS/sec_conn_getvpn/configuration/15-2mt/sec-get-VPN.html#GUID-6267F36C-094F-483F-A1CA-735D39484364

    Specifically "clear members ks gdoi crypto now."

    There is a particular risk that you thought?

    M.

  • Using the query to get the group by rollup subtotal

    Hello

    Expected output is, for 'chris' each record must have subtotal row because it has different 'no' of the column values.

    For 'John' the subtotal came as planned because she didn't even.

    Could you please correct the query for "chris" below!

     select   
    case when nm is null then 'Total'  
         when no is null then 'Subtotal'  
         else nm  
    end nm,no,emplmt,profund,status,dt,sal,days,intrst,intrs1,intrs2  
    from   
    (  
        with t as     
            (select 'chris' nm , 10 no ,'FT' Emplmt, 'PF' ProFund , 'Reg' Status ,to_Date ('01/22/2014','mm/dd/yyyy') dt , 2456 sal, 10 days , 50 intrst ,55 intrs1 ,60 intrs2 from dual    
            union all    
            select 'chris' nm , 20 no ,'FT' Emplmt, 'PF' ProFund , 'Reg' Status ,to_Date ('01/03/2014','mm/dd/yyyy') dt , 1000 sal, 30 days , 50 intrst ,55 intrs1 ,60 intrs2 from dual    
            union all    
            select 'chris' nm , 30 no ,'FT' Emplmt, 'PF' ProFund , 'NonReg' Status ,to_Date ('01/01/2014','mm/dd/yyyy') dt , 20 sal, -5 days , 1 intrst ,1 intrs1 ,1 intrs2 from dual    
           union all
           select 'john' nm , 11 no ,'PT' Emplmt, 'PF' ProFund , 'Reg' Status ,to_Date ('05/02/2014','mm/dd/yyyy') dt , 1153 sal, 10 days , 50 intrst ,55 intrs1 ,60 intrs2 from dual    
            union all    
            select 'john' nm , 11 no ,'PT' Emplmt, 'PF' ProFund , 'Reg' Status ,to_Date ('05/16/2014','mm/dd/yyyy') dt , 1000 sal, 8 days , 40 intrst ,45 intrs1 ,50 intrs2 from dual    
    
    
           )    
        select nm,no,emplmt,profund,status,dt,sum(sal)sal,sum(days)days,sum(intrst)intrst,sum(intrs1)intrs1,sum(intrs2)intrs2  
        from t  
        GROUP BY ROLLUP (nm,no,emplmt,profund,status,dt)  
        order by nm,no,emplmt,profund,status,dt  
    )  
    where (no is not null and emplmt is not null and profund is not null and status is not null and dt is not null)  
    or (no is null and emplmt is null and profund is null and status is null and dt is null)  
    

    allows us to use grouping sets to produce just the totals you want.

    with t as

    (select "chris" nm1, 10 no1, "Pi" Emplmt, "PF" ProFund "Reg" Status, to_Date (January 22, 2014 "," mm/dd/yyyy") dt, 2456 sal, 10 days, 50 intrst, intrs1 55 intrs2 60 double)

    Union of all the

    Select No, the "chris" nm, 20 'ft' Emplmt, "PF" ProFund "Reg" Status, to_Date (3 January 2014 "," mm/dd/yyyy") dt, intrst 50, intrs1 55, 1000 sal, 30 days, 60 intrs2 of the double

    Union of all the

    Select "chris" nm, 30 no, "Pi" Emplmt, ProFund "PF", "NonReg" State, to_Date (January 1, 2014 "," mm/dd/yyyy") dt, 20 sal,-5 days, 1 intrst, 1 intrs1, 1 intrs2 of the double

    Union of all the

    Select "Jean" nm, 11 no, "PT" Emplmt, "PF" ProFund "Reg" Status, to_Date (May 2, 2014 "," mm/dd/yyyy") dt, 1153 sal, 10 days, 50 intrst, intrs1 55 intrs2 60 double

    Union of all the

    Select "Jean" nm, 11 no, "PT" Emplmt, "PF" ProFund "Reg" Status, to_Date (16 may 2014 "," mm/dd/yyyy") dt, 1000 sal, 8 days, intrst 40, 45 intrs1, 50 intrs2 of the double

    )

    SELECT

    CASE

    WHEN grouping (nm1) = 1

    THEN "Total".

    WHEN grouping (emplmt) = 1

    THEN "Subtotal".

    Of ANOTHER nm1

    END nm,

    CASE

    WHEN grouping (emplmt) = 1

    THEN NULL

    Of ANOTHER no1

    END no emplmt, profund, status, dt, sal SUM (sal), SUM (days) days, SUM (intrst) intrst, SUM (intrs1) intrs1, intrs2 SUM (intrs2)

    T

    GROUP BY Grouping SETS ((), (nm1, no1), (nm1, no1, emplmt, profund, status, dt))

    ORDER BY nm1, no1, emplmt, profund, status, dt

    NM               NO EM PR STATUS DT              SAL       DAYS     INTRST     INTRS1     INTRS2 chris            10 FT PF Reg    22.01.14       2456         10         50         55         60 Subtotal                                        2456         10         50         55         60chris            20 FT PF Reg    03.01.14       1000         30         50         55         60 Subtotal                                        1000         30         50         55         60chris            30 FT PF NonReg 01.01.14         20         -5          1          1          1 Subtotal                                          20         -5          1          1          1john             11 PT PF Reg    02.05.14       1153         10         50         55         60 john             11 PT PF Reg    16.05.14       1000          8         40         45         50Subtotal                                        2153         18         90        100        110 Total                                           5629         53        191        211        231 
    
  • How the group based on a filter data

    Hello

    I have to build report master detail some conditions with tabular data, as provided in attachment ["Data.xml"]

    Requirement is,

    1 [level 1] group of Show Master Data by identifiant_volume

    2 [level 2] two banking details against ENTRY_TYPE = BS and receiving cash ENTRY_TYPE > CR under master group (both with different layout).

    3. [level 3] see the void individual details of Bank and cash received in reference to respective detail above (both with different layout)

    See presentation of the attachment [report.png]

    Note: it is possible either banking or cash receipt available or available

    Problem:

    I can't apply the filter to the level of the Group

    VT

    <? for-each-group: ROWSET1 / ROWSET1_ROW; / Identifiant_volume? >

    Some data fields...

    Bank

    <? for-each-group: current-group () / [ENTRY_TYPE ='BS']; / VOL_BK_ID? >

    Some data fields...

    <? for - each:current-group()? >

    Some data fields...

    <? end foreach? >

    <? end for each group -? >

    Receipt

    <? for-each-group: current-group () / [ENTRY_TYPE ='CR']; / VOL_BK_ID? >

    Some data fields...

    <? for - each:current-group()? >

    Some data fields...

    <? end foreach? >

    <? end for each group -? >

    <? end for each group -? >

    In fact, your syntax was wrong, I made some correction (in bold) it works fine, but in this code, you must manage the Bank and receipt of the case if anyone detailed the position isn't here.

    I hope that it would help your understanding,

    VT

    Some data fields...

    Bank

    <>[. / ENTRY_TYPE = "BS"]; / VOL_BK_ID? >

    Some data fields...

    Some data fields...

    Receipt

    <>[. / ENTRY_TYPE = "CS"]; / VOL_BK_ID? >


    Some data fields...

    Some data fields...

  • Replace the selection in the name of the group file name

    Hi guys,.

    I have a very good script that saved images much faster, but my colleagues are some problems ruefully at the end.

    var saveFile = file (oldPath + "/" + theNewName + "-" + doc.layerSets [a] .name + '.jpg');

    I use a tool to rename mass, but they find it too complicated, so I was wondering if it would be possible to change it to the following.

    The name of my group is called 'MUG-IMAGE '. The name of the file is "12345", so with the above the existing script maps, it will record it as '12345-MUG-IMAGE '. Then I use a mass renaming tool and move the 12345 at the end of the file name, so it reads as "MUG-IMAGE-12345".

    I have several groups who use this script in the same file, so the "12345" is always at the front, but ultimately must be rearranged to adapt to different points in the file names. So there may be 'CLOTHING-12345-WHITE' or 'CASE-BLACK-12345-SMALL.

    I want to know is if there is a way to insert an asterisk (or something similar) where I want the name of the file that you want to go? Thus, the name of my group would be "MUG - IMAGE-* ' and choose the file and run the script to register the group in JPEG format, it takes the file name and replace the asterixes with the name of the file, so it would be"MUG-IMAGE-12345"- and to do it for the different groups with Asterix different investments?

    I hope I made sense. I would really appreciate help on this issue.

    Thanks in advance!

    var fileName = theNewName.slice (0.5);

    If (indexOf("***")! = - 1) {}

    var saveFile = file (oldPath + "/" + "-" + doc.layerSets [a].name.replace ("*", fileName) + ".jpg");

    }

    else {}

    (var File(oldPath+"/"+"-"+doc.layerSets[a].name+"_"+fileName = saveFile) + ".jpg");

    };

    Does this work for you?

  • Use the case of the Cluster data without DRS storage store?

    Can someone tell me please the use case of the Cluster data without DRS storage store?

    Virtually no,.

    The only one that is useful is the aggregation of resources of data warehouses in a cluster data store. But it is aggregation of resources in its crudest form. When you create a virtual machine and the use of a cluster as the destination data store, you must always select the data store that will store the virtual machine.

    Storage DRS off =

    No calculation of initial investment

    No space load balancing

    No I/O load balancing

    No rule affinity VMDK

    No maintenance mode

    For this purpose a group of data without active DRS storage store is a kind of a data store folder.

  • Can not find a way to bypass the Group

    The following query runs as is, but only because I have included IntervForcl, IsSpecial , in the group by clause. I don't want group by these things, that month. I have no idea how to write this query, do what I want, I tried everything. Any suggestion would be appreciated.

    The end result is supossed to look something like this:

    PostedDate RushMargin NonRushMargin InteriorMargin

    2013.01 65.4% 42% 21.5%

    2013.02 62.7% 43.5% 32%

    2013.03 67.3% 41.1% 29.8%

    SELECT CONVERT (varchar (7), APPostedWhen, 102) AS [PostedDate].

    [InteriorMargin] = BOX

    WHEN intervforcl = 'k' THEN CAST (((APAMOUNT) AVG / AVG (ARAMOUNT)) * 100 AS DECIMAL (12,2))

    END,

    [RushMargin] = BOX

    WHEN IsSpecial = '1' CAST (((APAMOUNT) AVG / AVG (ARAMOUNT)) * 100 AS DECIMAL (12,2))

    END,

    [NonRushMargin] = BOX

    WHEN IsSpecial <>'1' THEN CAST (((APAMOUNT) AVG / AVG (ARAMOUNT)) * 100 AS DECIMAL (12,2))

    END

    Inspections

    WHERE DATEDIFF (MONTH, APPostedWhen, SYSDATETIME ()) < 6 AND ARAMOUNT > 0 AND APAMOUNT > 0

    GROUP OF CONVERT (varchar (7), APPostedWhen, 102)IntervForcl, IsSpecial

    ORDER BY [PostedDate]

    It is a forum for oracle pl/sql.

    What you think you have TSQL.

    However we need conditions case inside aggregate functions, I guess.

    as

    CAST ((AVG (affaire quand intervforcl = 'k' alors fin APAMOUNT) / AVG (case...)) (ARAMOUNT)) * 100 AS DECIMAL (12,2))

    and so on.

    Be careful on the way in which the aggregate function deal with NULL values.

  • Captivate in 8, can you apply an effect (for example, a transition) for the grouped shapes? (I can apply the effect to a single shape, but when I group forms, I can't understand how).

    Captivate in 8, can you apply an effect (for example, a transition) for the grouped shapes? (I can apply the effect to a single shape, but when I group forms, I can't understand how).

    Hello

    It is not possible to apply effects to groups of forms. You can apply the transition from the distribution panel and other properties in the property inspector.

    You will need to apply the same effect of the same duration for all objects in a group in this case.

    Thank you.

  • Is this a bug with the grouping sets?

    Version is the database of Oracle 11 g Enterprise Edition Release 11.2.0.3.0 - 64 bit Production
    SQL> with data as
      2  (select rownum r, 'X' x, 1 n from dual connect by rownum <= 10)
      3  select x
      4       , sum(n) s
      5       , (select sum(1) from dual where dummy = x) t
      6  from data
      7  group by grouping sets (x, ())
      8  /
    
    X          S          T
    - ---------- ----------
    X         10          1
              10
    SQL>  
    Shouldn't the superaggregate row have a 1 in the T column?

    Here's your QUERY with the addition of the GROUPING() function:

    SQL> WITH data AS
      2  (
      3     SELECT rownum r
      4          , 'X'    x
      5          , 1      n
      6     FROM   dual
      7     CONNECT BY rownum <= 10
      8  )
      9  SELECT GROUPING(x)
     10       , x
     11       , sum(n) s
     12       , (SELECT sum(1) FROM dual WHERE dummy = x) t
     13  FROM   data
     14  GROUP BY GROUPING SETS (x, ())
     15  ;
    
    GROUPING(X) X          S          T
    ----------- - ---------- ----------
              0 X         10          1
              1           10
    

    In this case, the value of X is zero because it is a subtotal line. If you look at this statement execution plan:

    PLAN_TABLE_OUTPUT
    ------------------------------------------------------------------------------------------------------------------------------
    SQL_ID  gumphwvgumqc4, child number 0
    -------------------------------------
    WITH data AS (  SELECT rownum r       , 'X'    x       , 1      n  FROM
      dual  CONNECT BY rownum <= 10 ) SELECT /*+gather_plan_statistics*/ x
        , sum(n) s      , (SELECT sum(1) FROM dual WHERE dummy = x) t FROM
     data GROUP BY GROUPING SETS (x, ())
    
    Plan hash value: 1718326399
    
    -----------------------------------------------------------------------------------------------------------------------------
    | Id  | Operation                       | Name | Starts | E-Rows | A-Rows |   A-Time   | Buffers |  OMem |  1Mem | Used-Mem |
    -----------------------------------------------------------------------------------------------------------------------------
    |   0 | SELECT STATEMENT                |      |      1 |        |      2 |00:00:00.01 |       0 |    |  |          |
    |   1 |  SORT AGGREGATE                 |      |      2 |      1 |      2 |00:00:00.01 |       4 |    |  |          |
    |*  2 |   TABLE ACCESS FULL             | DUAL |      2 |      1 |      1 |00:00:00.01 |       4 |    |  |          |
    |   3 |  SORT GROUP BY ROLLUP           |      |      1 |      1 |      2 |00:00:00.01 |       0 |  2048 |  2048 | 2048  (0)|
    |   4 |   VIEW                          |      |      1 |      1 |     10 |00:00:00.01 |       0 |    |  |          |
    |   5 |    COUNT                        |      |      1 |        |     10 |00:00:00.01 |       0 |    |  |          |
    |   6 |     CONNECT BY WITHOUT FILTERING|      |      1 |        |     10 |00:00:00.01 |       0 |    |  |          |
    |   7 |      FAST DUAL                  |      |      1 |      1 |      1 |00:00:00.01 |       0 |    |  |          |
    -----------------------------------------------------------------------------------------------------------------------------
    
    Predicate Information (identified by operation id):
    ---------------------------------------------------
    
       2 - filter("DUMMY"=:B1)
    

    The value of X is related to the subquery. If X is zero this returns no rows (I'm sure you already knew that :)). I would say it should although confusing behavior. You get the same results if you use CUBE or ROLLUP as well.

  • The index used is not in the group by.

    Here's the scenario with examples. The big table 333 to 500 million in the table rows. Statistics are collected. Are there histograms. Index is not however be used. Why?
      CREATE TABLE "XXFOCUS"."some_huge_data_table" 
       (  "ORG_ID" NUMBER NOT NULL ENABLE, 
      "PARTNERID" VARCHAR2(30) NOT NULL ENABLE, 
      "EDI_END_DATE" DATE NOT NULL ENABLE, 
      "CUSTOMER_ITEM_NUMBER" VARCHAR2(50) NOT NULL ENABLE, 
      "STORE_NUMBER" VARCHAR2(10) NOT NULL ENABLE, 
      "EDI_START_DATE" DATE, 
      "QTY_SOLD_UNIT" NUMBER(7,0), 
      "QTY_ON_ORDER_UNIT" NUMBER(7,0), 
      "QTY_ON_ORDER_AMT" NUMBER(10,2), 
      "QTY_ON_HAND_AMT" NUMBER(10,2), 
      "QTY_ON_HAND_UNIT" NUMBER(7,0), 
      "QTY_SOLD_AMT" NUMBER(10,2), 
      "QTY_RECEIVED_UNIT" NUMBER(7,0), 
      "QTY_RECEIVED_AMT" NUMBER(10,2), 
      "QTY_REQUISITION_RDC_UNIT" NUMBER(7,0), 
         "QTY_REQUISITION_RDC_AMT" NUMBER(10,2), 
         "QTY_REQUISITION_RCVD_UNIT" NUMBER(7,0), 
         "QTY_REQUISITION_RCVD_AMT" NUMBER(10,2), 
         "INSERTED_DATE" DATE, 
         "UPDATED_DATE" DATE, 
         "CUSTOMER_WEEK" NUMBER, 
         "CUSTOMER_MONTH" NUMBER, 
         "CUSTOMER_QUARTER" NUMBER, 
         "CUSTOMER_YEAR" NUMBER, 
         "CUSTOMER_ID" NUMBER, 
         "MONTH_NAME" VARCHAR2(3), 
         "ORG_WEEK" NUMBER, 
         "ORG_MONTH" NUMBER, 
         "ORG_QUARTER" NUMBER, 
         "ORG_YEAR" NUMBER, 
         "SITE_ID" NUMBER, 
         "ITEM_ID" NUMBER, 
         "ITEM_COST" NUMBER, 
         "UNIT_PRICE" NUMBER, 
          CONSTRAINT "some_huge_data_table_PK" PRIMARY KEY ("ORG_ID", "PARTNERID", "EDI_END_DATE", "CUSTOMER_ITEM_NUMBER", "STORE_NUMBER")
      USING INDEX TABLESPACE "xxxxx"  ENABLE, 
          CONSTRAINT "some_huge_data_table_CK_START_DATE" CHECK (edi_end_date - edi_start_date = 6) ENABLE
       );
    
    SQL*Plus: Release 11.2.0.2.0 Production on Fri Sep 14 12:11:16 2012
    
    Copyright (c) 1982, 2010, Oracle.  All rights reserved.
    
    
    Connected to:
    Oracle Database 11g Enterprise Edition Release 11.2.0.2.0 - 64bit Production
    With the Partitioning, OLAP, Data Mining and Real Application Testing options
    
    SQL> SELECT num_rows FROM user_tables s WHERE s.table_name = 'some_huge_data_table';
    
      NUM_ROWS                                                                      
    ----------                                                                      
     333338434                                                                      
    
    SQL> SELECT MAX(edi_end_date)
      2    FROM some_huge_data_table p
      3   WHERE p.org_id = some_number
      4     AND p.partnerid = 'some_string';
    
    MAX(EDI_E                                                                       
    ---------                                                                       
    13-MAY-12                                                                       
    
    Elapsed: 00:00:00.00
    
    
    SQL> explain plan for
      2  SELECT MAX(edi_end_date)
      3    FROM some_huge_data_table p
      4   WHERE p.org_id = some_number
      5     AND p.partnerid = 'some_string';
    
    Explained.
    
    SQL> /
    
    PLAN_TABLE_OUTPUT                                                                                   
    ----------------------------------------------------------------------------------------------------
    Plan hash value: 2104157595                                                                         
                                                                                                        
    --------------------------------------------------------------------------------------------        
    | Id  | Operation                    | Name        | Rows  | Bytes | Cost (%CPU)| Time     |        
    --------------------------------------------------------------------------------------------        
    |   0 | SELECT STATEMENT             |             |     1 |    22 |     4   (0)| 00:00:01 |        
    |   1 |  SORT AGGREGATE              |             |     1 |    22 |            |          |        
    |   2 |   FIRST ROW                  |             |     1 |    22 |     4   (0)| 00:00:01 |        
    |*  3 |    INDEX RANGE SCAN (MIN/MAX)| some_huge_data_table_PK |     1 |    22 |     4   (0)| 00:00:01 |        
    --------------------------------------------------------------------------------------------        
    
    SQL> explain plan for
      2  SELECT MAX(edi_end_date),
      3         org_id,
      4         partnerid
      5    FROM some_huge_data_table
      6   GROUP BY org_id,
      7            partnerid;
    
    Explained.
    
    PLAN_TABLE_OUTPUT                                                                                   
    ----------------------------------------------------------------------------------------------------
    Plan hash value: 3950336305                                                                         
                                                                                                        
    -------------------------------------------------------------------------------                     
    | Id  | Operation          | Name     | Rows  | Bytes | Cost (%CPU)| Time     |                     
    -------------------------------------------------------------------------------                     
    |   0 | SELECT STATEMENT   |          |     2 |    44 |  1605K  (1)| 05:21:03 |                     
    |   1 |  HASH GROUP BY     |          |     2 |    44 |  1605K  (1)| 05:21:03 |                     
    |   2 |   TABLE ACCESS FULL| some_huge_data_table |   333M|  6993M|  1592K  (1)| 05:18:33 |                     
    -------------------------------------------------------------------------------                     
    Why is he would not use the index in the group by? If I write a loop to search for different partnerid (there are only three), things together takes less than a second. Any help is appreciated.

    BTW, I too gave the index indicator. Did not work. Version mentioned in the example.

    Published by: RPuttagunta on September 14, 2012 11:24

    Published by: RPuttagunta on September 14, 2012 11:26

    the actual names are 'cleaned' for obvious reasons. Don't worry, I don't have the name of the tables in different cases.

    RPuttagunta wrote:

    Looks like either I called index_ss asked Jonathan a bad indicator, or, I don't know if he used the 'skip scan ".

    You don't specify correctly, it should be: index_ss (table_alias) or index_ss (table_alias index_name) or index_ss (table_alias (list of columns to index)).

    But I just tried a quick test on 11.2.0.3, and he does not have what we would really like to do.

    Concerning
    Jonathan Lewis

Maybe you are looking for