Group By clause in oracle 10g need help

Hello
We have a requirement that get the AR details of aging at the customer level. I wrote the following query to retrieve the correct rows at the invoice level. But now I need calculate the sum of the amounts and I show you the invoice and customer level. Could you please help me how can I group by the client.

Here's the query I used

Select ps.org_id
sobbed. SET_OF_BOOKS_ID
sobbed. CHART_OF_ACCOUNTS_ID
gcc. Company of SEGMENT1
gcc. SEGMENT2 location
gcc. Department of SEGMENT3
gcc. SEGMENT4 account
gcc. Future_1 SEGMENT5
gcc. SEGMENT6 Future_2
gcc. SEGMENT7 Future_3
gcc. CONCATENATED_SEGMENTS gl_cc_concat_kff
ps.trx_number
ps.trx_date
ps.due_date
ps.invoice_currency_code
sob.currency_code SOB_Currency_Code
ps.class
ps.amount_due_original
, ps.amount_due_original * nvl (ps.exchange_rate, 1) acctd_amount_due_original
ps.amount_due_remaining
ps.acctd_amount_due_remaining
ps.status
ps.cust_trx_type_id
ps.customer_site_use_id
ps.customer_trx_id
ps.cash_receipt_id
ps.gl_date
rctlda. CODE_COMBINATION_ID
ps.customer_id
nvl (ATCM. ATTRIBUTE5, ps. CUSTOMER_ID) End_Customer_Id
rc.customer_number
rc2. CUSTOMER_NUMBER Brand_Cust_no
, round ((sysdate-ps.due_date))
of gl_sets_of_books ob
, hr_operating_units or
ar_payment_schedules_all ps
ra_customers rc
ra_cust_trx_line_gl_dist_all rctlda
gl_code_combinations_kfv gcc
ra_customer_trx_all ATCM
ra_customers rc2
where sob.set_of_books_id = ou.set_of_books_id
and ou.organization_id = ps.org_id
and ps.status = 'OP '.
and ps.org_id is not null
and ps. CUSTOMER_ID = rc. CUSTOMER_ID
and ps. CUSTOMER_TRX_ID = rctlda. CUSTOMER_TRX_ID
and rctlda. ACCOUNT_CLASS = "REC".
and rctlda.latest_rec_flag = 'Y '.
and rctlda. CODE_COMBINATION_ID = gcc. CODE_COMBINATION_ID
and ps. CUSTOMER_TRX_ID = ATCM. CUSTOMER_TRX_ID
and gcc. CODE_COMBINATION_ID = 39446
- and ps.trx_number = 1-15O0A8O'
- and rc. CUSTOMER_NUMBER = 1-10PA5KX'
and nvl (ATCM. ATTRIBUTE5, ps. CUSTOMER_ID) = rc2. CUSTOMER_ID

Could someone help me how to recover the same columns with sum (ps.amount_due_original) for each client. I tried to use the group by clause, but it gives to new level of the invoice.
But my req's for each customer the amount of the invoice must be added and it should give the total

Thank you
THERE

If you need to have the amount of the invoice for each customer may also need to check the
CUBE
http://download.Oracle.com/docs/CD/B28359_01/server.111/b28286/statements_10002.htm#sthref9448
and example here
http://download.Oracle.com/docs/CD/B28359_01/server.111/b28286/statements_10002.htm#i2066443

and ROLLUP
http://download.Oracle.com/docs/CD/B28359_01/server.111/b28286/statements_10002.htm#sthref9445

I couldn't keep up with all your SQL statement, or I could rewrite for you once again
Thank you

Published by: user9532576 on July 21, 2009 09:24

Tags: Database

Similar Questions

  • From Oracle Lite, need help

    Hello world

    I have an application written in Java that connects to an Oracle 10g server and I want to use the same application on netbooks devices under WinXP. These devices use the application offline and then will synchronize with the DB.

    As far as I know, I need Oracle Lite database on mobile devices to get snapshots of database and track changes made in offline mode. I want to know if I need to install the Mobile Server to manage the synchronization of data between the mobile devices and DB.

    What I have to develop a web - app to manage the synchronization of the data, or there is an easier way to sinchronize in this case using only the desktop application?

    Thanks in advance for your help and sorry for my bad English.

    You want to watch the Win32 applications. There are the API in several programming languages which use the Sync Lite Oracle API to synchronize, or you can simply use the mSync.

  • [10g] need help with order by hierarchical query clause

    I have the following data samples:
    CREATE TABLE     bill_test1
    (     parent_part     CHAR(25)
    ,     child_part     CHAR(25)
    ,     line_nbr     NUMBER(5)
    ,     qty_per          NUMBER(9,5)
    );
    
    INSERT INTO bill_test1 VALUES ('ABC-1','ABC-10',100,1);
    INSERT INTO bill_test1 VALUES ('ABC-1','ABC-20',200,2);
    INSERT INTO bill_test1 VALUES ('ABC-1','ABC-30',300,3);
    INSERT INTO bill_test1 VALUES ('ABC-1','HARDWARE-1',401,10);
    INSERT INTO bill_test1 VALUES ('ABC-1','HARDWARE-2',402,5);
    INSERT INTO bill_test1 VALUES ('ABC-10','ABC-155',100,2);
    INSERT INTO bill_test1 VALUES ('ABC-10','HARDWARE-1',200,1);
    INSERT INTO bill_test1 VALUES ('ABC-155','RAW-2',100,4.8);
    INSERT INTO bill_test1 VALUES ('ABC-155','HARDWARE-3',200,3);
    INSERT INTO bill_test1 VALUES ('ABC-20','RAW-1',100,10.2);
    INSERT INTO bill_test1 VALUES ('ABC-30','RAW-3',100,3);
    And the following query gives me exactly what I want, in the order I want. However, I wonder if there is a way to get this order without creating the column SEQ, given that I don't need in my results
    SELECT     part_nbr
    ,     parent_part
    ,     child_part
    FROM     (
         SELECT     CONNECT_BY_ROOT b.parent_part                         AS part_nbr
         ,     b.parent_part
         ,     b.child_part
         ,     SYS_CONNECT_BY_PATH(b.line_nbr,' ')                    AS seq
         FROM     bill_test1 b
         ,     dual
         CONNECT BY     parent_part     = PRIOR child_part
         )
    WHERE          part_nbr     = 'ABC-1'
    ORDER BY     seq
    ;
    
    Results of above query, except with SEQ included in SELECT (just to show what I'm sorting off of):
    PART_NBR                     PARENT_PART                  CHILD_PART                   SEQ
    ---------------------------- ---------------------------- ---------------------------- -----------------
    ABC-1                        ABC-1                        ABC-10                        100
    ABC-1                        ABC-10                       ABC-155                       100 100
    ABC-1                        ABC-155                      RAW-2                         100 100 100
    ABC-1                        ABC-155                      HARDWARE-3                    100 100 200
    ABC-1                        ABC-10                       HARDWARE-1                    100 200
    ABC-1                        ABC-1                        ABC-20                        200
    ABC-1                        ABC-20                       RAW-1                         200 100
    ABC-1                        ABC-1                        ABC-30                        300
    ABC-1                        ABC-30                       RAW-3                         300 100
    ABC-1                        ABC-1                        HARDWARE-1                    401
    ABC-1                        ABC-1                        HARDWARE-2                    402

    Hello

    As long as there is that a single root, brothers and SŒURS of ORDER BY, you say, but you can not do in a subquery (well, you can, but usually there is no interest in a subquery). If the CONNECT BY in a subquery, there is no guarantee that the main request will preserve the hierarchical order which provides the subquery.

    The query you posted does not require a query of Tahina, so you can say:

    SELECT     CONNECT_BY_ROOT b.parent_part                         AS part_nbr
    ,     b.parent_part
    ,     b.child_part
    --,     SYS_CONNECT_BY_PATH(b.line_nbr,' ')                    AS seq
    FROM     bill_test1 b
    WHERE          CONNECT_BY_ROOT b.parent_part     = 'ABC-1'
    CONNECT BY     parent_part     = PRIOR child_part
    ORDER SIBLINGS BY     b.line_nbr
    ;
    

    I said the query you posted does not require a subquery. It also does not require double, so I guess that what you posted is a simplification of what you are really doing, and that could have a subquery. In particular, if you want to GROUP BY part_nbr, you need the subquery. We can use CONNECT_BY_ROOT expression in the WHERE clause (or, come to think of it, use a START WITH clause instead WHERE), but, for some reason, we cannot use CONNECT_BY_ROOT in a clause GROUP BY; We need to calculate CONNECT_BY_ROOT in a subquery, give it a name (like part_nbr) and Super GROUP OF this column in a query.

    This requires that there is that one node root. ORDER OF brothers and SŒURS means just that: children of a common parent will appear in the order, but the root nodes, which have no parents, may not be in order.

    Here's what I meant by using START WITH place WHERE:

    SELECT     CONNECT_BY_ROOT b.parent_part                         AS part_nbr
    ,     b.parent_part
    ,     b.child_part
    --,     SYS_CONNECT_BY_PATH(b.line_nbr,' ')                    AS seq
    FROM     bill_test1 b
    START WITH     b.parent_part     = 'ABC-1'
    CONNECT BY     parent_part     = PRIOR child_part
    ORDER SIBLINGS BY     b.line_nbr
    ;
    

    This should be much more effective, because it reduces the results before waste you your time by getting their descendants.
    With the help of a clause START WITH here is analogous to me sending you an email, saying "come to a meeting one my office at 03:00."
    By using a WHERE clause here is similar by sending me an e-mail to all members of society, saying: "come to a meeting one my office at 3:00" and then, as people get here, tell everyone except you could go back.

    Brothers and SŒURS ORDER BY was introduced in Oracle 9.

    Published by: Frank Kulash, December 9, 2010 14:39
    Added version with the START WITH clause

  • [Oracle 8i] Need help of a hierarchical query pruning branches

    My problem is that my hierarchical query seems only to cut values that do not meet my criteria, but still includes their children. When my query hits a record that does not meet my criteria, I want it to stop there. I tried including the criteria in just the ' ' a where clause of the query and also put the criteria in clause "connect by" as well, but nothing has been set. Will you please keep in mind that I'm using Oracle 8i, so I can't use some of the "nice" statements for hierarchical queries that they introduced in 9. I'm stuck with "Start With... Connect in "."

    I have examples of tables/data I can post if someone needs to see to help me, but to start with, here my current query:
    SELECT     *
    FROM     (
              SELECT 
                   LEVEL
              ,     c_bill.comp_part_nbr                     AS     c_part_nbr
              ,     (select c_part.part_desc 
                   FROM part c_part 
                   WHERE c_part.part_nbr=c_bill.comp_part_nbr)     AS     c_part_desc
              ,     (SELECT c_part.part_type 
                   FROM part c_part 
                   WHERE c_part.part_nbr=c_bill.comp_part_nbr)      AS     c_part_type
              ,     c_bill.qty_per                          AS     c_qty_per_p
              ,     c_bill.qty_per_type                     AS     c_qty_per_type
              ,     (SELECT c_part.qty_on_hand                
                   FROM part c_part 
                   WHERE c_part.part_nbr=c_bill.comp_part_nbr)      AS     c_qty_on_hand
              ,     c_bill.oper_nbr                     AS     rqd_at_op
              ,     c_bill.comp_off_adj                     AS     rqd_offset
              ,     c_bill.bom_doc_nbr                     AS     p_part_nbr
              ,     (SELECT p_part.qty_on_hand 
                   FROM part p_part 
                   WHERE p_part.part_nbr=c_bill.bom_doc_nbr)      AS     p_qty_on_hand
              FROM 
                   BILL c_bill 
              WHERE 
                   (
                             (c_bill.status           =      'RL')           
                        AND     (c_bill.view_code     IN      ('M','G'))     
                        AND     (c_bill.end_eff_dt     >      SYSDATE)       
                        AND     (c_bill.begn_eff_dt     <=      SYSDATE)
                   ) 
              START WITH c_bill.bom_doc_nbr=RPAD(?,25)
              CONNECT BY PRIOR c_bill.comp_part_nbr=c_bill.bom_doc_nbr
              AND     c_bill.view_code     IN     ('M','G')     
              AND     c_bill.status          =     'RL'
              AND      c_bill.end_eff_dt     >     SYSDATE
              AND     c_bill.begn_eff_dt     <=     SYSDATE     
         ) a
    WHERE     c_part_type = 'M'

    Hello

    The criterion in the outer query

    c_part_type = 'M'
    

    applies only to the results; You can still get the descendants of these lines in the output. This seems to be the only thing that is not repeated in the CONNECT BY clause.

    If you don't want to repeat the criteria in the WHERE clause and the CONECT BY clause, you can apply them once in a view online.
    The following example works in Oracle 8.1:

    SELECT     LPAD ( ' '
              , 3 * (LEVEL - 1)
              ) || ename          AS iname
    ,     empno
    ,     mgr
    FROM     (     -- Begin in-line view of employees named C-Z
         SELECT     ename
         ,     empno
         ,     mgr
         FROM     scott.emp
         WHERE     ename     >= 'C'
         )     -- End in-line view of employees named C-Z
    START WITH     mgr    IS NULL
    CONNECT BY     mgr    = PRIOR     empno
    ;
    

    Not only is excluded BLAKE, but the descendants of JAMES BLAKE, MARTIN, etc. are excluded, too, without repeating the condition.

    Please, post CREATE TABLE and INSERT statements for some examples of data - just enough to show what is the problem - and the results desired from these data.

  • How does the order by clause in oracle 10G?

    Hi This is my table called Master.I want to order by sno. so I run the below mentioned query.

    SNO DESC STIME, ETIME CCODE ADD SID

    11 11 11 1 10 s11

    1 1 s1 09:00 12:00 10

    2 2 s2 06:00 07:00 9

    3        3      S3        9:00       23:00                         0

    SELECT * FROM MASTER BY SNO

    SNO DESC STIME, ETIME CCODE ADD SID

    1 1 s1 09:00 12:00 10

    11      11         s11        11             1              10

    2         2         s2           6:00        7:00           9

    3         3         S3           09:00     23:00                        0

    but I had bad results. Help kindly me.i can't understand how the order by clause is fetching the record.

    Hello

    Most probably because that SNO is not digital, but a tank.

    If it contains a number onlly, try

    SELECT * FROM MASTER BY TO_NUMBER (SNO);

  • Need help with Jheadstart beginner

    Hello

    I'm new on JHeadstart. I need to migrate forms to ADF using JHeadstart oracle and need help. I have the suite version of JDeveloper

    JDevver.png

    According to the guidelines of this version compatibility matrix:http://www.oracle.com/technetwork/developer-tools/jheadstart/jhs-jdev-supportmatrix-084434.html

    I should be using JHeadstart 11.1.1.4 or 11.1.1.5 version

    I had actually installed JHeadstart via Jdeveloper using Hekp-> check for updates navigation and it seems that it has installed Version 11.1.1.3.33 (I don't know. it's what appears in the Index of the JHeadstart Documentation), which is not compatible with my version Jdev

    For this reason, according to the after screen shot, I'm not able to see "JHeadstart Forms2ADF" generator option during the creation of ADF BC.

    ADFBC.png


    How can I get an older version of JHeadstart, which is compatible to my JDeveloper?

    Help, please!


    Thank you

    Amit

    You need a license to download a full version. The evaluation version includes no Forms2ADF

    http://www.Oracle.com/technetwork/developer-tools/jheadstart/jheadstart-FAQ-085254.html#BM4a

  • How to put more than 1,000 values into a clause IN Oracle

    Is it possible to work around the limitation of 1000 elements of static clause IN Oracle 10g? I have a list of delimited by commas of a large number of ID that I want to use an IN clause, most of the time values can exceed 5000. And I don't have the privileges to create a temporary table, so that I can put all those to whom and run at a time.

    Thank you
    Marwa

    Hello

    Select * from hogehoge where col1 in (1, 5000);

    -> error

    Select * from hogehoge where col1 in (1.1000) or col1 in (1001.2000) or col1 in (2001.3000) or col1 in (3001.4000) or col1 in (4001.5000);

    -> may be OK

    Kind regards

  • Need help on query with decimal places and trailing 0

    Community of Oracle I need help in the following situations:

    I received the following query:
    SELECT (SUM ("VALUE1") COUNT ("VALUE2"))
    FROM sometable;

    This returns the following results:
    200
    222,5

    I want to display as 222.50 222,5 value so I tried ROUND(value,2) but then came to the conclusion that the tour will not show drags me 0.
    So now I tried to_char(value,'9999DD00') and of course he's back 200.00 both 222.50.

    Now how to make it conditional so when a number has no decimal place it shows the whole number and when it has a decimal, it shows it in the format to_char(value,'9999DD00')?

    I hope I have made my situation and question correctly and I hope a solution.

    P. S.
    I need to appear like that since it is an average of the prices of the products

    Published by: Jnijman on July 3, 2010 13:06

    You can use CASES and INSTR:

    SQL> with t as ( -- generating sample data:
      2  select 200 col from dual union
      3  select 222.5 from dual
      4  )
      5  --
      6  -- actual query:
      7  --
      8  select col
      9  ,      case
     10           when instr(col, ',') > 0
     11           then to_char(col, '999d00')
     12           else to_char(col, '999' )
     13         end formatted_col
     14  from   t;
    
           COL FORMATT
    ---------- -------
           200  200
         222,5  222,50
    
  • Oracle XE 10 g database offline have need help make comeback in 11g EE

    Our server crashed... completely crushed... own caught lightning outside. It was a material more old Server 2003, oracle 10g xe, so we replaced it with a newer better execution 2008r2 Server (64-bit, I might add).

    I need to bring the former base, storage and data files back online with the new server and the new Oracle instance.

    I have correctly installed oracle 11g EE and can create new a new database (everything is in line with that), but I need my old data back for PCM 13.1. I can't find any good documentation on this issue online, and we are down to what its corrected. Of course all data through is not going to work, so any help is very appreciated.

    I have good copies of old hard drives with folders intact structures, but there is no chance to get the old BONES without corresponding material old purchase online and just slamming the discs inside.

    Basically, how can I the new Oracle instance to open and run my old database... How to restore?

    I did it... Yay! Here's what I did... I installed a new copy of oracle 10g xe in my virtual xp mode. Stop the database after installation... removed and replaced the oradata and fast_recovery_area with my old data files. Started at the base of data and everything worked so far. In Server 2008 R2 I installed 11g xe, same password system. I then installed SQL Developer on both computers (easier for me to type scripts). In the XP mode 10g xe computer, I made a COMPLETE data pump export in a dump directory. Then I moved the dump on the new server file and ran a data pump import, add if existing data. Initially, failed... checked the newspaper and obviously I missed the fact the folder structure MUST be the same for the data files or I have to remap (too much work). The oradata default folder is different in 10g 11g. I created the oradata 11g xe folder in the same location as 10g put him and represented the import script. BAM, it worked this time... I have my data in 11g xe and my software has been able to find things as they should. Thank you for your consideration and help... hope this helps someone else down the road.

  • Need help for query flat_file type clobdata oracle table data.

    Hi Sir,

    I need help to query oracle table flat file data having given clob type.
    Oracle Version:
    
    Oracle Database 10g Express Edition Release 10.2.0.1.0 - Product
    PL/SQL Release 10.2.0.1.0 - Production
    "CORE     10.2.0.1.0     Production"
    TNS for 32-bit Windows: Version 10.2.0.1.0 - Production
    NLSRTL Version 10.2.0.1.0 - Production
    
    
    
    Source table
    
      CREATE TABLE order_details 
       (     QUEUE_SEQNUM NUMBER(10,0) NOT NULL ENABLE, 
         LINE_SEQNUM NUMBER(10,0) NOT NULL ENABLE, 
         CHAR_DATA CLOB, 
         OPTIMISTIC_LOCK_KEY NUMBER(20,0)
       ) 
    COLUMN FOR CHAR_DATA FLAT_FILE
    EU,6067AT,AT10,000000402004,NexiumGERDManagementProject,Z435,,ZZ29,NIS-GOLD,AT
    EU,6067AT,AT10,000000402038,NIS-OEU-ARI-2007/1,Z450,,ZZ29,NIS-OEU-ARI-2007/1,AT
    EU,6067AT,AT10,000000402039,SymbicortNISinCOPD,Z450,,ZZ29,NIS-REU-DUM-2007/1,AT
    EU,6067AT,AT10,000000402040,D1443L00044SeroquelXRRuby,Z450,,ZZ29,D1443L00044,AT
    EU,6067AT,AT10,000000402041,NIS-GEU-DUM-2008/1,Z450,,ZZ29,NIS-GEU-DUM-2008/1,AT
    EU,6067AT,AT10,000000402042,SonstigeAktivitätenLCM,Z450,,ZZ29,.,AT
    EU,6067AT,AT10,000000402134,D1680L00002Saxagliptin,Z450,,ZZ29,D1680L00002,AT
    EU,6067AT,AT10,000000402199,SeroquelWaveNIS,Z450,,ZZ29,NIS-NEU-DUM-2009/1,AT
    EU,6067AT,AT10,000000402313,SeroquelExtra(D1443L00082),Z450,,ZZ29,D1443L00082,AT
    EU,6067AT,AT10,000000402517,AtlanticD5130L00006(AZD6140),Z450,,ZZ29,D5130L00006,AT
    EU,6067AT,AT10,000000554494,ArimidexSt.Gallen(13+2),Z142,,ZZ09,,AT
    EU,6067AT,AT10,000000554495,ArimidexASCO(5delegates),Z142,,ZZ09,,AT
    EU,6067AT,AT10,000000554496,ArimidexSanAntonio6delegates,Z142,,ZZ09,,AT
    EU,6067AT,AT10,000000554497,ArimidexBreastCancerSummit(13+2),Z130,,ZZ09,,AT
    EU,6067AT,AT10,000000554498,ArimidexEIH(15delegates),Z130,,ZZ09,,AT
    EU,6067AT,AT10,000000554499,ArimidexNIFA(200delegates),Z135,,ZZ09,,AT
    EU,6067AT,AT10,000000554500,ArimidexNIFAworkshops(8x25),Z135,,ZZ09,,AT
    EU,6067AT,AT10,000000554501,ArimidexPraktischeGyn.Fortbildung,Z147,,ZZ09,,AT
    EU,6067AT,AT10,000000554502,ArimidexAGO,Z147,,ZZ09,,AT
    EU,6067AT,AT10,000000554503,ArimidexHämato/OnkologieKongress,Z147,,ZZ09,,AT
    EU,6067AT,AT10,000000554504,ARIMIDEXGYNäKOLOGENKONGRESS,Z147,,ZZ09,,AT
    EU,6067AT,AT10,000000554505,ArimidexChirurgenkongress,Z147,,ZZ09,,AT
    EXPECTED RESULTS:
    AFFIRM_CODE COMPANY_CODE INTERNAL_ORDER_CODE INTERNAL_ORDER_DESC ENIGMA_ACTIVITY             SUB_ACTIVITY_CODE IN_AFF_IND ORDER_TYPE EXTERNAL_ORDER COUNTRY        
    EU          6067AT       AT10                 000000402004       NEXIUMGERDMANAGEMENTPROJECT     Z435           NULL        ZZ29       NIS-GOLD        AT             
    EU          6068AT       AT11                 000000402005       NEXIUMGERDMANAGEMENTPROJECT     Z435           NULL        ZZ29       NIS-GOLD        AT             

    Sorry, my bad. Without database at hand, I'll try 'baby steps' (borrowed from Frank) so you don't confuse it with errors that I might add (happens far too often already, but at least you won't "swallow" as forum members think is one of the main goals of this fighter - help her learn - providing not only the proverbial fish.)
    Search the Forum - your problem is one of its best sellers. Watching {message identifier: = 10694602} ("split string into" was the key word used in research) you can try something as

    select table_row,
           level clob_row,
           regexp_substr(char_data,'[^' || chr(13) || chr(10) || ']+',1,level) the_line
      from (select to_char(queue_seqnum)||':'||to_char(line_seqnum) table_row,
                   char_data
              from order_details
           )
     connect by regexp_substr(char_data,'[^' || chr(13) || chr(10) || ']+',1,level) is not null
            and prior char_data = char_data
            and prior table_row = table_row
            and prior sys_guid() is not null
    

    to get all the s the_lineall CLOB and after that the use of the example even to get your columns of each the_line.

    Concerning

    Etbin

    Edited by: Etbin on 3.2.2013 09:01

    .. .but I m connected to do things according to the instructions, I can't do something.

    Used to happen to me too and I did as told to the but only after explaining any disadvantages, I was aware of in time. The last sentence is usually: "O.K. now be just and Don't come back with that kind of thing when it turns out that this isn't the right thing."
    rp0428 post - something to remember.

  • Need help with a query to group by return qroups with no result

    I have the following query that checks the number of items maintenance has been done for each paragraph in a support order.
    It lists all the paragraphs being checked it and the number of maintenance activities were conducted for that paragraph.
    It works very well in most of the cases, except some of the facilities to break their equipment into subcatagories from a specific facility specified in the lpm.equipment_ident field.
    For example, the tables and the data below are for the installation of ATL, which is breaking down for channels A and B maintenance activities

    The following query illustrates 10 maintenance activities for installation ATL and the query must be 5 for ATL channel A and 5 activities for ATL channel B

    This is the query, output current, output desired and all the SQL required to create the tables and data. I am using Oracle 11g

    Any help would be appreciated.
    -- Query
    SELECT req.publication_paragraph_number AS publication_paragraph
    -- , req.description
    , req.frequency
    , case upper (req.frequency) 
    WHEN 'DAILY'           THEN 365 
    WHEN 'WEEKLY'          THEN 52 
    WHEN 'MONTHLY'         THEN 12 
    WHEN 'QUARTERLY'       THEN 4 
    WHEN 'SEMIANNUALLY'    THEN 2
    WHEN 'ANNUALLY'        THEN 1
    ELSE 0
    END as num_req, 
    MAX(lpm.equipment_ident) AS equipment_ident
    , COUNT(fsep.fac_id) as activities_performed 
    FROM pm_requirements_table req 
    LEFT OUTER JOIN lpm_paragraph_mapping_table pmap 
    ON req.publication_order = pmap.publication_order AND req.publication_paragraph_number = pmap.publication_paragraph 
    LEFT OUTER JOIN lpm
    ON trim(lpm.publication_paragraph) = pmap.paragraph_alias_mapping 
    AND TRIM(lpm.publication_order) = '6310.19A' 
    AND TRUNC(lpm.start_date, 'YEAR') = TO_DATE('01/01/2010', 'MM/DD/YYYY')
    AND lpm.fac_ident = 'ATL' 
    LEFT OUTER JOIN fsep 
    ON fsep.fac_id = lpm.fac_ident 
    AND fsep.facility = lpm.fac_type
    GROUP BY req.publication_paragraph_number, req.description, req.frequency
    ORDER BY req.publication_paragraph_number;
    -- Current Output
    "PUBLICATION_PARAGRAPH"       "FREQUENCY"                   "NUM_REQ"              "EQUIPMENT_IDENT"             "ACTIVITIES_PERFORMED"
    "161A"                         "WEEKLY"                      "52"                          "CHAN B"                             "10"
    "161B"                         "WEEKLY"                      "52"                          "CHAN B"                             "10"
    "161C"                         "WEEKLY"                      "52"                          "CHAN B"                             "10"
    "161D(1)"                      "WEEKLY"                      "52"                          ""                                    "0"
    "161D(2)"                      "WEEKLY"                      "52"                          ""                                    "0"
    "161D(3)"                      "WEEKLY"                      "52"                          ""                                    "0"
    "161D(4)"                      "WEEKLY"                      "52"                          ""                                    "0"
    "161D(5)"                      "WEEKLY"                      "52"                          ""                                    "0"
    "161D(6)"                      "WEEKLY"                      "52"                          ""                                    "0"
    "161E"                         "WEEKLY"                      "52"                          ""                                    "0"
    "161F"                         "WEEKLY"                      "52"                          ""                                    "0"
    "161G"                         "WEEKLY"                      "52"                          ""                                    "0"
    "161H"                         "WEEKLY"                      "52"                          ""                                    "0"
    "161I"                         "WEEKLY"                      "52"                          ""                                    "0"
    "161J"                         "WEEKLY"                      "52"                          ""                                    "0"
    "161K"                         "WEEKLY"                      "52"                          ""                                    "0"
    -- Desired Output
    "PUBLICATION_PARAGRAPH"       "FREQUENCY"                   "NUM_REQ"              "EQUIPMENT_IDENT"             "ACTIVITIES_PERFORMED"
    "161A"                         "WEEKLY"                      "52"                          "CHAN A"                              "5"
    "161A"                         "WEEKLY"                      "52"                          "CHAN B"                              "5"
    "161B"                         "WEEKLY"                      "52"                          "CHAN A"                              "5"
    "161B"                         "WEEKLY"                      "52"                          "CHAN B"                              "5"
    "161C"                         "WEEKLY"                      "52"                          "CHAN A"                              "5"
    "161C"                         "WEEKLY"                      "52"                          "CHAN B"                              "5"
    "161D(1)"                      "WEEKLY"                      "52"                          ""                                    "0"
    "161D(2)"                      "WEEKLY"                      "52"                          ""                                    "0"
    "161D(3)"                      "WEEKLY"                      "52"                          ""                                    "0"
    "161D(4)"                      "WEEKLY"                      "52"                          ""                                    "0"
    "161D(5)"                      "WEEKLY"                      "52"                          ""                                    "0"
    "161D(6)"                      "WEEKLY"                      "52"                          ""                                    "0"
    "161E"                         "WEEKLY"                      "52"                          ""                                    "0"
    "161F"                         "WEEKLY"                      "52"                          ""                                    "0"
    "161G"                         "WEEKLY"                      "52"                          ""                                    "0"
    "161H"                         "WEEKLY"                      "52"                          ""                                    "0"
    "161I"                         "WEEKLY"                      "52"                          ""                                    "0"
    "161J"                         "WEEKLY"                      "52"                          ""                                    "0"
    "161K"                         "WEEKLY"                      "52"                          ""                                    "0"
    -- Tables and Data
    CREATE TABLE "LPM"
      (
        "LOG_ID"              NUMBER(22,0) NOT NULL ENABLE,
        "FAC_IDENT"           VARCHAR2(5 BYTE),
        "FAC_TYPE"            VARCHAR2(5 BYTE),
        "CODE_CATEGORY"       NUMBER(22,0) NOT NULL ENABLE,
        "SUPPLEMENTAL_CODE"   VARCHAR2(1 BYTE),
        "MAINT_ACTION_CODE"   VARCHAR2(1 BYTE),
        "INTERRUPT_CONDITION" VARCHAR2(22 BYTE),
        "ATOW_CODE"           VARCHAR2(22 BYTE),
        "SECTOR_CODE"         VARCHAR2(5 BYTE),
        "LOG_STATUS"          VARCHAR2(3 BYTE) NOT NULL ENABLE,
        "START_DATE" DATE,
        "START_DATETIME" VARCHAR2(22 BYTE),
        "END_DATE" DATE,
        "END_DATETIME"      VARCHAR2(22 BYTE),
        "MODIFIED_DATETIME" VARCHAR2(22 BYTE),
        "WR_AREA"           VARCHAR2(6 BYTE),
        "SHORT_NAME"        VARCHAR2(15 BYTE),
        "EQUIPMENT_IDENT"   VARCHAR2(15 BYTE),
        "INTERVAL_CODE"     VARCHAR2(255 BYTE),
        "EARLIEST_DATE"     VARCHAR2(4000 BYTE),
        "EARLIEST_DATETIME" VARCHAR2(255 BYTE),
        "SCHEDULED_DATE" DATE,
        "SCHEDULED_DATETIME" VARCHAR2(22 BYTE),
        "LATEST_DATE" DATE,
        "LATEST_DATETIME"                VARCHAR2(22 BYTE),
        "WR_CREW_UNIT"                   VARCHAR2(10 BYTE),
        "WR_WATCH"                       VARCHAR2(1 BYTE),
        "PUBLICATION_ORDER"              VARCHAR2(30 BYTE),
        "PUBLICATION_ORDER_ORIGINAL"     VARCHAR2(30 BYTE),
        "PUBLICATION_PARAGRAPH"          VARCHAR2(30 BYTE),
        "PUBLICATION_PARAGRAPH_ORIGINAL" VARCHAR2(30 BYTE),
        "NUMBER_OF_TASKS"                VARCHAR2(25 BYTE),
        "LOG_SUMMARY"                    VARCHAR2(255 BYTE),
        "COMMENTS" CLOB,
        "RELATED_LOGS" CLOB,
        "LPMANTAC_ID" NUMBER
      );
    
    CREATE TABLE "FSEP"
      (
        "FAC_ID"               VARCHAR2(10 BYTE),
        "FACILITY"             VARCHAR2(5 BYTE),
        "FAC_LOCATION"         VARCHAR2(13 BYTE),
        "FAC_STATE"            VARCHAR2(2 BYTE),
        "REGION"               VARCHAR2(2 BYTE),
        "COST_CENTER"          VARCHAR2(8 BYTE) NOT NULL ENABLE,
        "ATOW_ORG"             VARCHAR2(150 BYTE),
        "ATOW_ORG_DESCRIPTION" VARCHAR2(150 BYTE),
        "SVC_AREA"             VARCHAR2(5 BYTE),
        "SECTOR_CODE"          VARCHAR2(5 BYTE),
        "FAC_CODE"             VARCHAR2(20 BYTE),
        "FAC_STATUS"           CHAR(1 BYTE) NOT NULL ENABLE,
        "RESTORATION_CODE"     VARCHAR2(2 BYTE),
        "RESPONSIBILITY_CODE"  CHAR(1 BYTE),
        "POWER_CODE"           CHAR(1 BYTE),
        "FAC_STATUS_DATE" DATE,
        "FAC_SWAP_DATE" DATE,
        "CHANGE_DATE"        VARCHAR2(22 BYTE),
        "GSA_ADDRESS"        VARCHAR2(15 BYTE),
        "INV"                VARCHAR2(2 BYTE),
        "SDP_TYPE"           VARCHAR2(5 BYTE),
        "SDP_IDENT"          VARCHAR2(4 BYTE),
        "CONTROL_IDENT"      VARCHAR2(10 BYTE),
        "REMOTE_IDENT"       VARCHAR2(10 BYTE),
        "MONITOR_IDENT"      VARCHAR2(4 BYTE),
        "RUNWAY"             VARCHAR2(3 BYTE),
        "ASSOC_AIRPORT"      VARCHAR2(4 BYTE),
        "FAC_MPS_SITE"       CHAR(4 BYTE),
        "FREQS_IN_PLACE"     NUMBER(22,0),
        "CONGRESSIONAL_DIS"  VARCHAR2(2 BYTE),
        "CONTRACT_MAINT_PER" NUMBER(22,0),
        "AIR_COND"           CHAR(1 BYTE),
        "FAC_UNITS"          NUMBER(22,0),
        "ET_PRIMARY_IDENT"   VARCHAR2(4 BYTE),
        "ET_PRIMARY_TYPE"    VARCHAR2(5 BYTE),
        "ENV_PRIMARY_IDENT"  VARCHAR2(4 BYTE),
        "ENV_PRIMARY_TYPE"   VARCHAR2(5 BYTE),
        "FAC_CODE_DESC"      VARCHAR2(100 BYTE),
        "STATUS_DESC"        VARCHAR2(50 BYTE),
        "RESTORATION_DESC"   VARCHAR2(32 BYTE),
        "POWER_DESC"         VARCHAR2(500 BYTE),
        "LATITUDE"           VARCHAR2(150 BYTE),
        "LONGITUDE"          VARCHAR2(150 BYTE),
        "ELEVATION"          VARCHAR2(22 BYTE),
        "MOD_COUNT"          VARCHAR2(22 BYTE),
        "HYPERLINK"          VARCHAR2(255 BYTE),
        "FSEPANTAC_ID"       NUMBER
    );
    
    CREATE TABLE "LPM_PARAGRAPH_MAPPING_TABLE"
      (
        "PUBLICATION_ORDER"       VARCHAR2(30 BYTE),
        "PUBLICATION_PARAGRAPH"   VARCHAR2(30 BYTE),
        "PARAGRAPH_ALIAS_MAPPING" VARCHAR2(30 BYTE),
        "LPMTANTAC_ID"            NUMBER
    );
    
    CREATE TABLE "PM_REQUIREMENTS_TABLE"
      (
        "PUBLICATION_ORDER"            VARCHAR2(30 BYTE),
        "PUBLICATION_PARAGRAPH_NUMBER" VARCHAR2(30 BYTE),
        "DESCRIPTION"                  VARCHAR2(4000 BYTE),
        "FREQUENCY"                    VARCHAR2(30 BYTE),
        "CHECK_OR_MAINTENANCE"         VARCHAR2(22 BYTE),
        "PRTANTAC_ID"                  NUMBER);
    
    Insert into lpm (LOG_ID,FAC_IDENT,FAC_TYPE,CODE_CATEGORY,SUPPLEMENTAL_CODE,MAINT_ACTION_CODE,INTERRUPT_CONDITION,ATOW_CODE,SECTOR_CODE,LOG_STATUS,START_DATE,START_DATETIME,END_DATE,END_DATETIME,MODIFIED_DATETIME,WR_AREA,SHORT_NAME,EQUIPMENT_IDENT,INTERVAL_CODE,EARLIEST_DATE,EARLIEST_DATETIME,SCHEDULED_DATE,SCHEDULED_DATETIME,LATEST_DATE,LATEST_DATETIME,WR_CREW_UNIT,WR_WATCH,PUBLICATION_ORDER,PUBLICATION_ORDER_ORIGINAL,PUBLICATION_PARAGRAPH,PUBLICATION_PARAGRAPH_ORIGINAL,NUMBER_OF_TASKS,LOG_SUMMARY,COMMENTS,RELATED_LOGS,LPMANTAC_ID) values (108306002,'ATL','ASR',50,'0','P',null,'WEQ1C','SO1LB','C',to_date('02-MAY-10','DD-MON-RR'),'05/02/2010 21:00',to_date('02-MAY-10','DD-MON-RR'),'05/02/2010 21:30','05/03/2010 1:07','RADAR','SYS','CHAN B','W','05/02/2010','05/02/2010 0:00',to_date('05-MAY-10','DD-MON-RR'),'05/05/2010 0:00',to_date('08-MAY-10','DD-MON-RR'),'05/08/2010 0:00','RADR',null,'6310.19A','6310.19A','161A-J','161 A-J','15',null, EMPTY_CLOB(), EMPTY_CLOB(),14297);
    Insert into lpm (LOG_ID,FAC_IDENT,FAC_TYPE,CODE_CATEGORY,SUPPLEMENTAL_CODE,MAINT_ACTION_CODE,INTERRUPT_CONDITION,ATOW_CODE,SECTOR_CODE,LOG_STATUS,START_DATE,START_DATETIME,END_DATE,END_DATETIME,MODIFIED_DATETIME,WR_AREA,SHORT_NAME,EQUIPMENT_IDENT,INTERVAL_CODE,EARLIEST_DATE,EARLIEST_DATETIME,SCHEDULED_DATE,SCHEDULED_DATETIME,LATEST_DATE,LATEST_DATETIME,WR_CREW_UNIT,WR_WATCH,PUBLICATION_ORDER,PUBLICATION_ORDER_ORIGINAL,PUBLICATION_PARAGRAPH,PUBLICATION_PARAGRAPH_ORIGINAL,NUMBER_OF_TASKS,LOG_SUMMARY,COMMENTS,RELATED_LOGS,LPMANTAC_ID) values (108306102,'ATL','ASR',50,'0','P',null,'WEQ1C','SO1LB','C',to_date('02-MAY-10','DD-MON-RR'),'05/02/2010 21:00',to_date('02-MAY-10','DD-MON-RR'),'05/02/2010 21:30','05/03/2010 1:07','RADAR','SYS','CHAN A','W','05/02/2010','05/02/2010 0:00',to_date('05-MAY-10','DD-MON-RR'),'05/05/2010 0:00',to_date('08-MAY-10','DD-MON-RR'),'05/08/2010 0:00','RADR',null,'6310.19A','6310.19A','161A-J','161 A-J','15',null, EMPTY_CLOB(), EMPTY_CLOB(),14298);
    Insert into lpm (LOG_ID,FAC_IDENT,FAC_TYPE,CODE_CATEGORY,SUPPLEMENTAL_CODE,MAINT_ACTION_CODE,INTERRUPT_CONDITION,ATOW_CODE,SECTOR_CODE,LOG_STATUS,START_DATE,START_DATETIME,END_DATE,END_DATETIME,MODIFIED_DATETIME,WR_AREA,SHORT_NAME,EQUIPMENT_IDENT,INTERVAL_CODE,EARLIEST_DATE,EARLIEST_DATETIME,SCHEDULED_DATE,SCHEDULED_DATETIME,LATEST_DATE,LATEST_DATETIME,WR_CREW_UNIT,WR_WATCH,PUBLICATION_ORDER,PUBLICATION_ORDER_ORIGINAL,PUBLICATION_PARAGRAPH,PUBLICATION_PARAGRAPH_ORIGINAL,NUMBER_OF_TASKS,LOG_SUMMARY,COMMENTS,RELATED_LOGS,LPMANTAC_ID) values (104188402,'ATL','ASR',50,'0','P',null,'WEQ1C','SO1LB','C',to_date('26-APR-10','DD-MON-RR'),'4/26/2010 13:33',to_date('26-APR-10','DD-MON-RR'),'4/26/2010 13:46','4/26/2010 15:23','RADAR','SYS','CHAN A','W','4/25/2010','4/25/2010 0:00',to_date('28-APR-10','DD-MON-RR'),'4/28/2010 0:00',to_date('01-MAY-10','DD-MON-RR'),'05/01/2010 0:00','RADR',null,'6310.19A','6310.19A','161A-J','161 A-J','15',null, EMPTY_CLOB(), EMPTY_CLOB(),14306);
    Insert into lpm (LOG_ID,FAC_IDENT,FAC_TYPE,CODE_CATEGORY,SUPPLEMENTAL_CODE,MAINT_ACTION_CODE,INTERRUPT_CONDITION,ATOW_CODE,SECTOR_CODE,LOG_STATUS,START_DATE,START_DATETIME,END_DATE,END_DATETIME,MODIFIED_DATETIME,WR_AREA,SHORT_NAME,EQUIPMENT_IDENT,INTERVAL_CODE,EARLIEST_DATE,EARLIEST_DATETIME,SCHEDULED_DATE,SCHEDULED_DATETIME,LATEST_DATE,LATEST_DATETIME,WR_CREW_UNIT,WR_WATCH,PUBLICATION_ORDER,PUBLICATION_ORDER_ORIGINAL,PUBLICATION_PARAGRAPH,PUBLICATION_PARAGRAPH_ORIGINAL,NUMBER_OF_TASKS,LOG_SUMMARY,COMMENTS,RELATED_LOGS,LPMANTAC_ID) values (104188502,'ATL','ASR',50,'0','P',null,'WEQ1C','SO1LB','C',to_date('26-APR-10','DD-MON-RR'),'4/26/2010 13:33',to_date('26-APR-10','DD-MON-RR'),'4/26/2010 13:46','4/26/2010 15:23','RADAR','SYS','CHAN B','W','4/25/2010','4/25/2010 0:00',to_date('28-APR-10','DD-MON-RR'),'4/28/2010 0:00',to_date('01-MAY-10','DD-MON-RR'),'05/01/2010 0:00','RADR',null,'6310.19A','6310.19A','161A-J','161 A-J','15',null, EMPTY_CLOB(), EMPTY_CLOB(),14307);
    Insert into lpm (LOG_ID,FAC_IDENT,FAC_TYPE,CODE_CATEGORY,SUPPLEMENTAL_CODE,MAINT_ACTION_CODE,INTERRUPT_CONDITION,ATOW_CODE,SECTOR_CODE,LOG_STATUS,START_DATE,START_DATETIME,END_DATE,END_DATETIME,MODIFIED_DATETIME,WR_AREA,SHORT_NAME,EQUIPMENT_IDENT,INTERVAL_CODE,EARLIEST_DATE,EARLIEST_DATETIME,SCHEDULED_DATE,SCHEDULED_DATETIME,LATEST_DATE,LATEST_DATETIME,WR_CREW_UNIT,WR_WATCH,PUBLICATION_ORDER,PUBLICATION_ORDER_ORIGINAL,PUBLICATION_PARAGRAPH,PUBLICATION_PARAGRAPH_ORIGINAL,NUMBER_OF_TASKS,LOG_SUMMARY,COMMENTS,RELATED_LOGS,LPMANTAC_ID) values (101223702,'ATL','ASR',50,'0','P',null,'WEQ1C','SO1LB','C',to_date('19-APR-10','DD-MON-RR'),'4/19/2010 1:30',to_date('19-APR-10','DD-MON-RR'),'4/19/2010 2:10','4/19/2010 3:12','RADAR','SYS','CHAN B','W','4/18/2010','4/18/2010 0:00',to_date('21-APR-10','DD-MON-RR'),'4/21/2010 0:00',to_date('24-APR-10','DD-MON-RR'),'4/24/2010 0:00','RADR',null,'6310.19A','6310.19A','161A-J','161 A-J','15',null, EMPTY_CLOB(), EMPTY_CLOB(),14322);
    Insert into lpm (LOG_ID,FAC_IDENT,FAC_TYPE,CODE_CATEGORY,SUPPLEMENTAL_CODE,MAINT_ACTION_CODE,INTERRUPT_CONDITION,ATOW_CODE,SECTOR_CODE,LOG_STATUS,START_DATE,START_DATETIME,END_DATE,END_DATETIME,MODIFIED_DATETIME,WR_AREA,SHORT_NAME,EQUIPMENT_IDENT,INTERVAL_CODE,EARLIEST_DATE,EARLIEST_DATETIME,SCHEDULED_DATE,SCHEDULED_DATETIME,LATEST_DATE,LATEST_DATETIME,WR_CREW_UNIT,WR_WATCH,PUBLICATION_ORDER,PUBLICATION_ORDER_ORIGINAL,PUBLICATION_PARAGRAPH,PUBLICATION_PARAGRAPH_ORIGINAL,NUMBER_OF_TASKS,LOG_SUMMARY,COMMENTS,RELATED_LOGS,LPMANTAC_ID) values (101223802,'ATL','ASR',50,'0','P',null,'WEQ1C','SO1LB','C',to_date('19-APR-10','DD-MON-RR'),'4/19/2010 1:30',to_date('19-APR-10','DD-MON-RR'),'4/19/2010 2:10','4/19/2010 3:12','RADAR','SYS','CHAN A','W','4/18/2010','4/18/2010 0:00',to_date('21-APR-10','DD-MON-RR'),'4/21/2010 0:00',to_date('24-APR-10','DD-MON-RR'),'4/24/2010 0:00','RADR',null,'6310.19A','6310.19A','161A-J','161 A-J','15',null, EMPTY_CLOB(), EMPTY_CLOB(),14323);
    Insert into lpm (LOG_ID,FAC_IDENT,FAC_TYPE,CODE_CATEGORY,SUPPLEMENTAL_CODE,MAINT_ACTION_CODE,INTERRUPT_CONDITION,ATOW_CODE,SECTOR_CODE,LOG_STATUS,START_DATE,START_DATETIME,END_DATE,END_DATETIME,MODIFIED_DATETIME,WR_AREA,SHORT_NAME,EQUIPMENT_IDENT,INTERVAL_CODE,EARLIEST_DATE,EARLIEST_DATETIME,SCHEDULED_DATE,SCHEDULED_DATETIME,LATEST_DATE,LATEST_DATETIME,WR_CREW_UNIT,WR_WATCH,PUBLICATION_ORDER,PUBLICATION_ORDER_ORIGINAL,PUBLICATION_PARAGRAPH,PUBLICATION_PARAGRAPH_ORIGINAL,NUMBER_OF_TASKS,LOG_SUMMARY,COMMENTS,RELATED_LOGS,LPMANTAC_ID) values (96642402,'ATL','ASR',50,'0','P',null,'WEQ1C','SO1LB','C',to_date('11-APR-10','DD-MON-RR'),'04/11/2010 11:10',to_date('11-APR-10','DD-MON-RR'),'04/11/2010 11:15','04/11/2010 12:51','RADAR','SYS','CHAN B','W','04/11/2010','04/11/2010 0:00',to_date('14-APR-10','DD-MON-RR'),'4/14/2010 0:00',to_date('17-APR-10','DD-MON-RR'),'4/17/2010 0:00','RADR',null,'6310.19A','6310.19A','161A-J','161 A-J','15',null, EMPTY_CLOB(), EMPTY_CLOB(),14335);
    Insert into lpm (LOG_ID,FAC_IDENT,FAC_TYPE,CODE_CATEGORY,SUPPLEMENTAL_CODE,MAINT_ACTION_CODE,INTERRUPT_CONDITION,ATOW_CODE,SECTOR_CODE,LOG_STATUS,START_DATE,START_DATETIME,END_DATE,END_DATETIME,MODIFIED_DATETIME,WR_AREA,SHORT_NAME,EQUIPMENT_IDENT,INTERVAL_CODE,EARLIEST_DATE,EARLIEST_DATETIME,SCHEDULED_DATE,SCHEDULED_DATETIME,LATEST_DATE,LATEST_DATETIME,WR_CREW_UNIT,WR_WATCH,PUBLICATION_ORDER,PUBLICATION_ORDER_ORIGINAL,PUBLICATION_PARAGRAPH,PUBLICATION_PARAGRAPH_ORIGINAL,NUMBER_OF_TASKS,LOG_SUMMARY,COMMENTS,RELATED_LOGS,LPMANTAC_ID) values (96642302,'ATL','ASR',50,'0','P',null,'WEQ1C','SO1LB','C',to_date('11-APR-10','DD-MON-RR'),'04/11/2010 11:05',to_date('11-APR-10','DD-MON-RR'),'04/11/2010 11:10','04/11/2010 12:51','RADAR','SYS','CHAN A','W','04/11/2010','04/11/2010 0:00',to_date('14-APR-10','DD-MON-RR'),'4/14/2010 0:00',to_date('17-APR-10','DD-MON-RR'),'4/17/2010 0:00','RADR',null,'6310.19A','6310.19A','161A-J','161 A-J','15',null, EMPTY_CLOB(), EMPTY_CLOB(),14336);
    Insert into lpm (LOG_ID,FAC_IDENT,FAC_TYPE,CODE_CATEGORY,SUPPLEMENTAL_CODE,MAINT_ACTION_CODE,INTERRUPT_CONDITION,ATOW_CODE,SECTOR_CODE,LOG_STATUS,START_DATE,START_DATETIME,END_DATE,END_DATETIME,MODIFIED_DATETIME,WR_AREA,SHORT_NAME,EQUIPMENT_IDENT,INTERVAL_CODE,EARLIEST_DATE,EARLIEST_DATETIME,SCHEDULED_DATE,SCHEDULED_DATETIME,LATEST_DATE,LATEST_DATETIME,WR_CREW_UNIT,WR_WATCH,PUBLICATION_ORDER,PUBLICATION_ORDER_ORIGINAL,PUBLICATION_PARAGRAPH,PUBLICATION_PARAGRAPH_ORIGINAL,NUMBER_OF_TASKS,LOG_SUMMARY,COMMENTS,RELATED_LOGS,LPMANTAC_ID) values (92805502,'ATL','ASR',50,'0','P',null,'WEQ1C','SO1LB','C',to_date('07-APR-10','DD-MON-RR'),'04/07/2010 18:10',to_date('07-APR-10','DD-MON-RR'),'04/07/2010 18:22','04/07/2010 19:04','RADAR','SYS','CHAN A','W','04/04/2010','04/04/2010 0:00',to_date('07-APR-10','DD-MON-RR'),'04/07/2010 0:00',to_date('10-APR-10','DD-MON-RR'),'04/10/2010 0:00','RADR',null,'6310.19A','6310.19A','161A-J','161 A-J','15',null, EMPTY_CLOB(), EMPTY_CLOB(),14342);
    Insert into lpm (LOG_ID,FAC_IDENT,FAC_TYPE,CODE_CATEGORY,SUPPLEMENTAL_CODE,MAINT_ACTION_CODE,INTERRUPT_CONDITION,ATOW_CODE,SECTOR_CODE,LOG_STATUS,START_DATE,START_DATETIME,END_DATE,END_DATETIME,MODIFIED_DATETIME,WR_AREA,SHORT_NAME,EQUIPMENT_IDENT,INTERVAL_CODE,EARLIEST_DATE,EARLIEST_DATETIME,SCHEDULED_DATE,SCHEDULED_DATETIME,LATEST_DATE,LATEST_DATETIME,WR_CREW_UNIT,WR_WATCH,PUBLICATION_ORDER,PUBLICATION_ORDER_ORIGINAL,PUBLICATION_PARAGRAPH,PUBLICATION_PARAGRAPH_ORIGINAL,NUMBER_OF_TASKS,LOG_SUMMARY,COMMENTS,RELATED_LOGS,LPMANTAC_ID) values (92805402,'ATL','ASR',50,'0','P',null,'WEQ1C','SO1LB','C',to_date('07-APR-10','DD-MON-RR'),'04/07/2010 17:53',to_date('07-APR-10','DD-MON-RR'),'04/07/2010 18:05','04/07/2010 19:04','RADAR','SYS','CHAN B','W','04/04/2010','04/04/2010 0:00',to_date('07-APR-10','DD-MON-RR'),'04/07/2010 0:00',to_date('10-APR-10','DD-MON-RR'),'04/10/2010 0:00','RADR',null,'6310.19A','6310.19A','161A-J','161 A-J','15',null, EMPTY_CLOB(), EMPTY_CLOB(),14343);
    
    Insert into fsep (FAC_ID,FACILITY,FAC_LOCATION,FAC_STATE,REGION,COST_CENTER,ATOW_ORG,ATOW_ORG_DESCRIPTION,SVC_AREA,SECTOR_CODE,FAC_CODE,FAC_STATUS,RESTORATION_CODE,RESPONSIBILITY_CODE,POWER_CODE,FAC_STATUS_DATE,FAC_SWAP_DATE,CHANGE_DATE,GSA_ADDRESS,INV,SDP_TYPE,SDP_IDENT,CONTROL_IDENT,REMOTE_IDENT,MONITOR_IDENT,RUNWAY,ASSOC_AIRPORT,FAC_MPS_SITE,FREQS_IN_PLACE,CONGRESSIONAL_DIS,CONTRACT_MAINT_PER,AIR_COND,FAC_UNITS,ET_PRIMARY_IDENT,ET_PRIMARY_TYPE,ENV_PRIMARY_IDENT,ENV_PRIMARY_TYPE,FAC_CODE_DESC,STATUS_DESC,RESTORATION_DESC,POWER_DESC,LATITUDE,LONGITUDE,ELEVATION,MOD_COUNT,HYPERLINK,FSEPANTAC_ID) values ('ATL','ASR','ATLANTA','GA','SO','081LB','WEQ1C','Hartsfield Radar SSC','ESA','SO1LB','453ACA','D','4','A','A',to_date('01-OCT-50','DD-MON-RR'),to_date('01-OCT-95','DD-MON-RR'),'11/17/2010 8:51','43JW','RD','TRACO','A80','A80','ATL','A80',null,'ATL','ZTL ',0,'5',0,'A',1,null,null,null,null,'ASR-9   STANDARD FACILITY','Commissioned/Full Service','Up to 4 Hours','Denotes a commercial power source a standby engine generator and an Uninterruptible Power Supply (UPS).  This configuration shall provide uninterruptible conditioned power with AC voltage in and AC voltage out.','33.62875','-8.43003','1030','2','http://technet.faa.gov/fsep/fsepDetail.asp?recordno=ASRATL',32084);
    Insert into fsep (FAC_ID,FACILITY,FAC_LOCATION,FAC_STATE,REGION,COST_CENTER,ATOW_ORG,ATOW_ORG_DESCRIPTION,SVC_AREA,SECTOR_CODE,FAC_CODE,FAC_STATUS,RESTORATION_CODE,RESPONSIBILITY_CODE,POWER_CODE,FAC_STATUS_DATE,FAC_SWAP_DATE,CHANGE_DATE,GSA_ADDRESS,INV,SDP_TYPE,SDP_IDENT,CONTROL_IDENT,REMOTE_IDENT,MONITOR_IDENT,RUNWAY,ASSOC_AIRPORT,FAC_MPS_SITE,FREQS_IN_PLACE,CONGRESSIONAL_DIS,CONTRACT_MAINT_PER,AIR_COND,FAC_UNITS,ET_PRIMARY_IDENT,ET_PRIMARY_TYPE,ENV_PRIMARY_IDENT,ENV_PRIMARY_TYPE,FAC_CODE_DESC,STATUS_DESC,RESTORATION_DESC,POWER_DESC,LATITUDE,LONGITUDE,ELEVATION,MOD_COUNT,HYPERLINK,FSEPANTAC_ID) values ('ATL','GS','ATLANTA','GA','SO','081MB','WEQ1A','Hartsfield Nav/Comm SSC','ESA','SO1MB','314JAH','D','24','A','D',to_date('18-NOV-49','DD-MON-RR'),to_date('01-DEC-96','DD-MON-RR'),'3/4/2009 14:40','43JX','21','ATCT','ATL','ATL',null,'A80','08R','ATL','ZTL ',0,'5',0,'A',1,null,null,null,null,'MARK 20 CAPTURE EFFECT CAT III W/RMM','Commissioned/Full Service','Up to 24 Hours','Denotes a commercial power source and a battery standby power system.  A UPS is not included in this category.','33.64788','-84.43426','1012','2','http://technet.faa.gov/fsep/fsepDetail.asp?recordno=GSATL',32109);
    
    Insert into LPM_PARAGRAPH_MAPPING_TABLE (PUBLICATION_ORDER,PUBLICATION_PARAGRAPH,PARAGRAPH_ALIAS_MAPPING,LPMTANTAC_ID) values ('6310.19A','161A','161',1708);
    Insert into LPM_PARAGRAPH_MAPPING_TABLE (PUBLICATION_ORDER,PUBLICATION_PARAGRAPH,PARAGRAPH_ALIAS_MAPPING,LPMTANTAC_ID) values ('6310.19A','161A','161A-J',1709);
    Insert into LPM_PARAGRAPH_MAPPING_TABLE (PUBLICATION_ORDER,PUBLICATION_PARAGRAPH,PARAGRAPH_ALIAS_MAPPING,LPMTANTAC_ID) values ('6310.19A','161B','161',1736);
    Insert into LPM_PARAGRAPH_MAPPING_TABLE (PUBLICATION_ORDER,PUBLICATION_PARAGRAPH,PARAGRAPH_ALIAS_MAPPING,LPMTANTAC_ID) values ('6310.19A','161B','161A-J',1737);
    Insert into LPM_PARAGRAPH_MAPPING_TABLE (PUBLICATION_ORDER,PUBLICATION_PARAGRAPH,PARAGRAPH_ALIAS_MAPPING,LPMTANTAC_ID) values ('6310.19A','161C','161',1765);
    Insert into LPM_PARAGRAPH_MAPPING_TABLE (PUBLICATION_ORDER,PUBLICATION_PARAGRAPH,PARAGRAPH_ALIAS_MAPPING,LPMTANTAC_ID) values ('6310.19A','161C','161A-J',1766);
    Insert into LPM_PARAGRAPH_MAPPING_TABLE (PUBLICATION_ORDER,PUBLICATION_PARAGRAPH,PARAGRAPH_ALIAS_MAPPING,LPMTANTAC_ID) values ('6310.19A','161C','161(A-->K)',1769);
    Insert into LPM_PARAGRAPH_MAPPING_TABLE (PUBLICATION_ORDER,PUBLICATION_PARAGRAPH,PARAGRAPH_ALIAS_MAPPING,LPMTANTAC_ID) values ('6310.19A','161C','161(A-K)',1774);
    Insert into LPM_PARAGRAPH_MAPPING_TABLE (PUBLICATION_ORDER,PUBLICATION_PARAGRAPH,PARAGRAPH_ALIAS_MAPPING,LPMTANTAC_ID) values ('6310.19A','161C','161.(A-C).',1775);
    Insert into LPM_PARAGRAPH_MAPPING_TABLE (PUBLICATION_ORDER,PUBLICATION_PARAGRAPH,PARAGRAPH_ALIAS_MAPPING,LPMTANTAC_ID) values ('6310.19A','161D(1)','161',1793);
    Insert into LPM_PARAGRAPH_MAPPING_TABLE (PUBLICATION_ORDER,PUBLICATION_PARAGRAPH,PARAGRAPH_ALIAS_MAPPING,LPMTANTAC_ID) values ('6310.19A','161D(1)','161161 A-J',1794);
    Insert into LPM_PARAGRAPH_MAPPING_TABLE (PUBLICATION_ORDER,PUBLICATION_PARAGRAPH,PARAGRAPH_ALIAS_MAPPING,LPMTANTAC_ID) values ('6310.19A','161D(2)','161',1821);
    Insert into LPM_PARAGRAPH_MAPPING_TABLE (PUBLICATION_ORDER,PUBLICATION_PARAGRAPH,PARAGRAPH_ALIAS_MAPPING,LPMTANTAC_ID) values ('6310.19A','161D(2)','161 A-J',1822);
    Insert into LPM_PARAGRAPH_MAPPING_TABLE (PUBLICATION_ORDER,PUBLICATION_PARAGRAPH,PARAGRAPH_ALIAS_MAPPING,LPMTANTAC_ID) values ('6310.19A','161D(2)','161(A-->K)',1825);
    Insert into LPM_PARAGRAPH_MAPPING_TABLE (PUBLICATION_ORDER,PUBLICATION_PARAGRAPH,PARAGRAPH_ALIAS_MAPPING,LPMTANTAC_ID) values ('6310.19A','161K','161.K',1825);
    
    Insert into PM_REQUIREMENTS_TABLE (PUBLICATION_ORDER,PUBLICATION_PARAGRAPH_NUMBER,DESCRIPTION,FREQUENCY,CHECK_OR_MAINTENANCE,PRTANTAC_ID) values ('6310.19A','161A','Check transmitter average rf power output','WEEKLY',null,3);
    Insert into PM_REQUIREMENTS_TABLE (PUBLICATION_ORDER,PUBLICATION_PARAGRAPH_NUMBER,DESCRIPTION,FREQUENCY,CHECK_OR_MAINTENANCE,PRTANTAC_ID) values ('6310.19A','161B','Check transmitter VSWR','WEEKLY',null,4);
    Insert into PM_REQUIREMENTS_TABLE (PUBLICATION_ORDER,PUBLICATION_PARAGRAPH_NUMBER,DESCRIPTION,FREQUENCY,CHECK_OR_MAINTENANCE,PRTANTAC_ID) values ('6310.19A','161C','Check RMS transmitter pulse width','WEEKLY',null,5);
    Insert into PM_REQUIREMENTS_TABLE (PUBLICATION_ORDER,PUBLICATION_PARAGRAPH_NUMBER,DESCRIPTION,FREQUENCY,CHECK_OR_MAINTENANCE,PRTANTAC_ID) values ('6310.19A','161D(1)','Check filament current','WEEKLY',null,6);
    Insert into PM_REQUIREMENTS_TABLE (PUBLICATION_ORDER,PUBLICATION_PARAGRAPH_NUMBER,DESCRIPTION,FREQUENCY,CHECK_OR_MAINTENANCE,PRTANTAC_ID) values ('6310.19A','161D(2)','Check focus coil current','WEEKLY',null,7);
    Insert into PM_REQUIREMENTS_TABLE (PUBLICATION_ORDER,PUBLICATION_PARAGRAPH_NUMBER,DESCRIPTION,FREQUENCY,CHECK_OR_MAINTENANCE,PRTANTAC_ID) values ('6310.19A','161D(3)','Check Klystron voltage','WEEKLY',null,8);
    Insert into PM_REQUIREMENTS_TABLE (PUBLICATION_ORDER,PUBLICATION_PARAGRAPH_NUMBER,DESCRIPTION,FREQUENCY,CHECK_OR_MAINTENANCE,PRTANTAC_ID) values ('6310.19A','161D(4)','Check Klystron current','WEEKLY',null,9);
    Insert into PM_REQUIREMENTS_TABLE (PUBLICATION_ORDER,PUBLICATION_PARAGRAPH_NUMBER,DESCRIPTION,FREQUENCY,CHECK_OR_MAINTENANCE,PRTANTAC_ID) values ('6310.19A','161D(5)','Check PFN voltage','WEEKLY',null,10);
    Insert into PM_REQUIREMENTS_TABLE (PUBLICATION_ORDER,PUBLICATION_PARAGRAPH_NUMBER,DESCRIPTION,FREQUENCY,CHECK_OR_MAINTENANCE,PRTANTAC_ID) values ('6310.19A','161D(6)','Check vacuum pump current','WEEKLY',null,11);
    Insert into PM_REQUIREMENTS_TABLE (PUBLICATION_ORDER,PUBLICATION_PARAGRAPH_NUMBER,DESCRIPTION,FREQUENCY,CHECK_OR_MAINTENANCE,PRTANTAC_ID) values ('6310.19A','161E','Check target receiver MDS','WEEKLY',null,12);
    Insert into PM_REQUIREMENTS_TABLE (PUBLICATION_ORDER,PUBLICATION_PARAGRAPH_NUMBER,DESCRIPTION,FREQUENCY,CHECK_OR_MAINTENANCE,PRTANTAC_ID) values ('6310.19A','161F','Check target receiver NF','WEEKLY',null,13);
    Insert into PM_REQUIREMENTS_TABLE (PUBLICATION_ORDER,PUBLICATION_PARAGRAPH_NUMBER,DESCRIPTION,FREQUENCY,CHECK_OR_MAINTENANCE,PRTANTAC_ID) values ('6310.19A','161G','Check target receiver recovery','WEEKLY',null,14);
    Insert into PM_REQUIREMENTS_TABLE (PUBLICATION_ORDER,PUBLICATION_PARAGRAPH_NUMBER,DESCRIPTION,FREQUENCY,CHECK_OR_MAINTENANCE,PRTANTAC_ID) values ('6310.19A','161H','Check weather receiver MDS','WEEKLY',null,15);
    Insert into PM_REQUIREMENTS_TABLE (PUBLICATION_ORDER,PUBLICATION_PARAGRAPH_NUMBER,DESCRIPTION,FREQUENCY,CHECK_OR_MAINTENANCE,PRTANTAC_ID) values ('6310.19A','161I','Check weather receiver NF','WEEKLY',null,16);
    Insert into PM_REQUIREMENTS_TABLE (PUBLICATION_ORDER,PUBLICATION_PARAGRAPH_NUMBER,DESCRIPTION,FREQUENCY,CHECK_OR_MAINTENANCE,PRTANTAC_ID) values ('6310.19A','161J','Check weather receiver recovery','WEEKLY',null,17);
    Insert into PM_REQUIREMENTS_TABLE (PUBLICATION_ORDER,PUBLICATION_PARAGRAPH_NUMBER,DESCRIPTION,FREQUENCY,CHECK_OR_MAINTENANCE,PRTANTAC_ID) values ('6310.19A','161K','Check spare modem operation','WEEKLY',null,18);
    Published by: George Heller on July 20, 2011 13:45

    Published by: George Heller on July 20, 2011 13:46

    Published by: George Heller on July 20, 2011 13:48

    Hi, George.

    I think I understand now!
    You want outer join table req on the result of all the other joined tables. You want all the lines of the req to be represented in the result set, even if they have no match in the other tables, but it is the only outer join you want. You don't want to necessarily, for example, all rows in the table pmap represented. In this case, the join involving req should be an outer join, but all the other joins are inner joins.

    Here's a way to do it:

    SELECT    req.publication_paragraph_number AS publication_paragraph
    -- ,        req.description
    ,         req.frequency
    ,        CASE   UPPER (req.frequency)
               WHEN 'DAILY'           THEN 365
               WHEN 'WEEKLY'          THEN  52
               WHEN 'MONTHLY'         THEN  12
               WHEN 'QUARTERLY'       THEN   4
               WHEN 'SEMIANNUALLY'    THEN   2
               WHEN 'ANNUALLY'        THEN   1
               ELSE 0
           END                    AS num_req
    ,       lpm.equipment_ident
    ,        COUNT (fsep.fac_id)          AS activities_performed
    FROM             pm_requirements_table          req
    LEFT OUTER JOIN (
                            lpm_paragraph_mapping_table     pmap
              JOIN  lpm
                                       ON   TRIM (lpm.publication_paragraph) = pmap.paragraph_alias_mapping
                                       AND  TRIM (lpm.publication_order)         = '6310.19A'
                                       AND  TRUNC (lpm.start_date, 'YEAR')   = TO_DATE ('01/01/2010', 'MM/DD/YYYY')
                                       AND  lpm.fac_ident                   = 'ATL'
                    JOIN  fsep
                                       ON   fsep.fac_id     = lpm.fac_ident
                                       AND  fsep.facility = lpm.fac_type
              )
                                     ON       req.publication_order             = pmap.publication_order
                             AND         req.publication_paragraph_number = pmap.publication_paragraph
    GROUP BY  req.publication_paragraph_number, req.description, req.frequency, lpm.equipment_ident
    ORDER BY  req.publication_paragraph_number
    ;
    

    Only the FROM clause has changed since yesterday.
    Output:

    `                                      ACTIV
    PUBLICAT                               ITIES
    ION_PARA                      EQUIPMEN _PERF
    GRAPH    FREQUENCY    NUM_REQ T_IDENT  ORMED
    -------- --------- ---------- -------- -----
    161A     WEEKLY            52 CHAN A       5
    161A     WEEKLY            52 CHAN B       5
    161B     WEEKLY            52 CHAN A       5
    161B     WEEKLY            52 CHAN B       5
    161C     WEEKLY            52 CHAN A       5
    161C     WEEKLY            52 CHAN B       5
    161D(1)  WEEKLY            52              0
    161D(2)  WEEKLY            52              0
    161D(3)  WEEKLY            52              0
    161D(4)  WEEKLY            52              0
    161D(5)  WEEKLY            52              0
    161D(6)  WEEKLY            52              0
    161E     WEEKLY            52              0
    161F     WEEKLY            52              0
    161G     WEEKLY            52              0
    161H     WEEKLY            52              0
    161I     WEEKLY            52              0
    161J     WEEKLY            52              0
    161K     WEEKLY            52              0
    
  • Need help with Oracle SQL merge records according to date and term dates

    Hi all

    I need help to find this little challenge.

    I have groups and flags and effective dashboards and dates of term against these indicators according to the following example:

    GroupName Flag_A Flag_B Eff_date Term_date
    Group_ATHERETHERE2011010199991231
    Group_ANN2010010120101231
    Group_ANN2009010120091231
    Group_ANN2006010120081231
    Group_ANTHERE2004010120051231
    Group_ATHERETHERE2003010120031231
    Group_BNTHERE2004010199991231
    Group_BNTHERE2003010120031231

    As you can see, group_A had the same combination of (N, N) flag for three successive periods. I want to merge all the time periods with the same indicators in one. Where entry into force will be the most early (underlined) time period and end date will be later (underlined)

    So the final result should look like this:

    GroupName Flag_A Flag_B Eff_date Term_date
    Group_ATHERETHERE2011010199991231
    Group_ANN2006010120101231
    Group_ANTHERE2004010120051231
    Group_ATHERETHERE2003010120031231
    Group_BNTHERE2003010199991231

    Thanks for your help

    Here's the DDL script

    drop table TMP_group_test;

    create table TMP_group_test (groupname varchar2 (8))

    , flag_a varchar2 (1)

    , flag_b varchar2 (1)

    , eff_date varchar2 (8)

    , term_date varchar2 (8)

    );

    insert into TMP_group_test values ('Group_A', 'Y', 'Y', ' 20110101 ', ' 99991231');

    insert into TMP_group_test values ('Group_A', 'n', ' n ', ' 20100101 ', ' 20101231');

    insert into TMP_group_test values ('Group_A', 'n', ' n ', ' 20090101 ', ' 20091231');

    insert into TMP_group_test values ('Group_A', 'n', ' n ', ' 20060101 ', ' 20081231');

    insert into TMP_group_test values ('Group_A', 'n', 'Y', ' 20040101 ', ' 20051231');

    insert into TMP_group_test values ('Group_A', 'Y', 'Y', ' 20030101 ', ' 20031231');

    insert into TMP_group_test values ('Group_B', 'n', 'Y', ' 20040101 ', ' 99991231');

    insert into TMP_group_test values ('Group_B', 'n', 'Y', ' 20030101 ', ' 20031231');

    commit;

    Post edited by: user13040446

    It is the closest, I went to the solution


    I create two rows;

    Rnk1: partition by group name, order of eff_date / / desc: this grade will sort the records of the most recent and handed to zero for each group\

    Rnk2: (dense) partition by group name, flag_A, flagb: this grade for each combination of group\flag gives a number so that they are classified as "families".

    Then I use the function analytic min

    Min (eff_date) more (partition of GroupName, rnk2): the idea is that, for each Member of the same family, the new date is the min of the family (and the max for the date of the term), at the end I just need separate so that the duplicates are gone

    Now the problem. As you can see from the query below, records of 1 and 6 (as identified by rownum) are identified in the same family, because they have the same combination of flag, but they are not successive, so everyone must keep its own date of entry into force.

    If only I can make the distinction between these two that would solve my problem


    Query:


    Select rowNum,GroupName, flag_a, flag_b, eff_date, term_date, rnk1, rnk2

    , min (eff_date) more than (partition by GroupName rnk2( ) min_eff

    Of

    (

    Select rowNum,

    GroupName , flag_a , flag_b , eff_date , term_date

    rank() more than (partition by GroupName stopped by eff_date desc) rnk1

    DENSE_RANK() more than (partition by GroupName order by flag_A flag_B ( ) rnk2

    de dsreports . tmp_group_test

    ) order by rowNum

    Hello

    user13040446 wrote:

    Hi KSI.

    Thanks for your comments, you were able to distinguish between these lines highlight, but lost lines 2,3,4 which are supposed to have the same date min = 20060101.

    Please see the table wanted to see the final result I want to reach

    Thanks again

    This first answer is basically correct, but in the main query, you want to use the function MIN, not the analytical function aggregation and GROUP BY columns with common values, like this:

    WITH got_output_group AS

    (

    SELECT GroupName, flag_a, flag_b, eff_date, term_date

    ROW_NUMBER () OVER (PARTITION BY GroupName

    ORDER BY eff_date

    )

    -ROW_NUMBER () OVER (PARTITION BY GroupName, flag_a, flag_b)

    ORDER BY eff_date

    ) AS output_group

    OF tmp_group_test

    )

    SELECT GroupName, flag_a, flag_b

    MIN (eff_date) AS eff_date

    MAX (term_date) AS term_date

    OF got_output_group

    GROUP BY GroupName, flag_a, flag_b

    output_group

    ORDER BY GroupName

    eff_date DESC

    ;

    The result I get is

    GROUP_NA F F EFF_DATE TERM_DAT

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

    Group_A Y 20110101 99991231 Y

    N Group_A 20101231 20060101 N

    Group_A N 20051231 20040101 Y

    Group_A Y Y 20031231-20030101

    Group_B N Y 99991231 20030101

    which is what you asked for.

  • Need help to install Oracle Business Intelligence 11.1.1 Applications. 7.1

    Hello

    I intend to install some Applications Oracle Business Intelligence 11.1.1.7.1 in my machine. I need some clarification before you install it.

    (1) can I install and run unity of repository on the local computer (that is not a server)?

    (2) don't need an application server for the installation of the Oracle Applications Business Intelligence 11.1.1.7.1?  If so where should I install the server applications or server or in my local computer?

    Thanks in advance

    Here you go...

    (1) can I install and run unity of repository on the local computer (that is not a server)?

    Yes, you can, if you have a database and ongoing running and accessible from your machine.

    (2) don't need an application server for the installation of the Oracle Applications Business Intelligence 11.1.1.7.1?  If so where should I install the server applications or server or in my local computer?

    Yes you need, and it will be good to have it on your machine.

    Before installing, make sure that you have min 4 GB of ram to work actively on OBIEE.

    So useful mark...

    Let me know if you need help with the installation.

  • Need help to provide a page for the Oracle PeopleSoft HCM on internet

    Hello

    I need help to provide that a page of Oracle PeopleSoft HCM on internet for vacancies may be available for recruitment. How can I provide a Peoplesoft Web page?

    TKS

    Bruno will read

    Of Peoplebooks

    Access to external Sites

    External candidates, by definition, do not have the nicknames PeopleSoft. To allow external users access to a site, you put a link to the site on a location such as your public Web site. The site definition includes a field to set the URL of this external link.

    Deployed in this mode, the instance of PeopleSoft to be accessed by external users must have the appropriate security settings to allow users to bypass the access code. In other words, a user who clicks on the link is not presented with a PeopleSoft signon pages but is instead signed the using a user ID generic comments so that the user can be taken directly to the candidate Gateway.

    If an external candidate allows a more inactive candidate gateway session that the timeout you set, the default system behavior is to provide a link to the login page of PeopleSoft with the visible invited user ID.  According to your logic of password, the guest user ID might be locked if the applicant tries in vain to connect. For more security and ease of use, replace the code page to a page that displays an appropriate message.   For example, to display a message that the session has expired and provide a link back to the bridge of the candidate.

    Development of Sites

  • Trying to get SQL to Oracle via VBScript - help needed connection

    Hello
    I really need help please because I am new to VBScript and TNS connections and all this stuff is complicated.
    I'm trying to make a connection with one of our Oracle servers and to extract some database through SQL commands, but after trying for a few days, I'm stumped.

    Here are the details, and I hope someone can advise me in simple language on where I'm wrong.


    The I'm trying to connect from is an Essbase server that already has an ODBC connection to the Oracle Server installation in the ODBC data source administrator. The driver that I see in the ODBC data source administrator is 'Oracle in OraClient10g_home1' and a "SQL Sever" driver as well as some drivers OEM MEARNT.
    The tnsnames.ora has the information for the Oracle server and I can't tnsping to it successfully.
    Navigation around the web, I tried a few methods to connect:


    "Driver = {Microsoft ODBC for Oracle};" DBQ = ABCD; UID = username; Pwd = PASSWORD; »
    I get the error message:
    "Provider is not specified and there is no designated default provider."


    I understand that I don't have the Microsoft ODBC for Oracle installed driver, do not know if we need if we have the Oracle in OraClient10g_home1 driver and have a connection established. So I tried:


    "Driver = {Oracle in OraClient10g_home1}; DBQ = ABCD; UID = username; Pwd = PASSWORD; »

    Once again... "Provider is not specified and there is no designated default provider."

    I also tried another suggested method:


    Dim strCon

    strCon = "Driver = {Oracle in OraClient10g_home1}"; "." & _
    "CONNECTSTRING = (DESCRIPTION ="& _.
    "(ADDRESS =(PROTOCOL=TCP)"& _
    "(HOST = EssbaseServer)(PORT=1592))" & _
    "(CONNECT_DATA = (SERVICE_NAME = ABCD))); UID = LOGIN; pwd = PASSWORD; »

    Ollivier Dim: Set Ocón = WScript.CreateObject ("ADODB. Connection")
    Dim oRs: Set oRs = WScript.CreateObject ("ADODB. Recordset')
    oCon.Open strCon
    oCon.Close

    Set oRs = Nothing
    Define Ocón = Nothing
    Again same error message:
    Provider is not specified and there is no designated default provider.

    This leads me to think that maybe I need to have the Microsoft ODBC for Oracle drivers installed on the server. Maybe I need to fix my script differently and am totally done badly. Any help please? If you think I need the driver could you please explain why and how this works if I can put forward for my argument to install it on the server.

    Thank you very much

    I'm not an expert in vbscript, but a few times I used ADODB to connect to Oracle with success. Something like

    'Database connection info
    set Conn = CreateObject("ADODB.connection")
    Conn.ConnectionTimeout = 30
    Conn.CommandTimeout = 30
    if dbType = "oracle" then
         conn.open("Provider=MSDAORA.1;User ID=" & dbUser & ";Password=" & dbPass & ";Data Source=" & dbName & ";Persist Security Info=False")
    elseif dbType = "sqlserver" then
         conn.open("Driver={SQL Server};Server=" & dbHost & ";Database=" & dbName & ";Uid=" & dbUser & ";Pwd=" & dbPass & ";")
    elseif dbType = "mysql" then
         conn.open("DRIVER={MySQL ODBC 3.51 Driver}; SERVER=" & dbHost & ";PORT=3306;DATABASE=" & dbName & "; UID=" & dbUser & "; PASSWORD=" & dbPass & "; OPTION=3")
    end if
    

    These variables are defined as

    dbType = "oracle"                 ' Valid values: "oracle", "sqlserver", "mysql"
    dbHost = "mrs-db-00021.abc-xyz.com"                 ' Hostname of the database server
    dbName = "LDBS_PRD"                 ' Name of the database/SID
    dbUser = "myuser"               ' Name of the user
    dbPass = "xxxx2212"               ' Password of the above-named user
    

Maybe you are looking for

  • A single site is text display problems, but it is not the case with IE.

    The text does not appear on a single website only, and only in a part of the site and there seems to be only one type of text. http://WOL.JW.org/en/WOL/h/R1/LP-e http://WOL.JW.org/en/WOL/b/R1/LP-e/NWT/E/2013/45/14 It is the Bible, and the text of the

  • Why don't fix you just Firefox continues to respond as he did before?

    Must be reset every day - the instructions given in the forum are complicated, boring and do not work. I need to change for Chrome? Thank you.

  • alligaterdanger

    I can't update my iphone via itunes applications. They do not display anything and it doesn't show any available updates. Please help me... **************** < email published by host >

  • Crash when recording video Message

    Hey: Every time I want to record a video of Massage, it stops working and says that close the program, windows looking for a problem. Then Skype quited. Skype is an other programs work correctly. Please help me for fixing. [The update by the moderato

  • Satellite 5100-503 "locked" maybe BIOS

    I had recently bought a new HARD drive because of problems in the previous, then the HDD have nothing in it. But when I thought everything was fixed, I discovered a new problem.Whenever I turn on the computer a try to access the boot priority to choo