Need help with SQL Query with Inline View + Group by

Hello Gurus,
I would really appreciate your time and effort regarding this query. I have the following data set.
Reference_No---Check_Number---Check_Date--------Description-------------------------------Invoice_Number----------Invoice_Type---Paid_Amount-----Vendor_Number
1234567----------11223-------------- 7/5/2008----------paid for cleaning----------------------44345563------------------I-----------------*20.00*-------------19
1234567----------11223--------------7/5/2008-----------Adjustment for bad quality---------44345563------------------A-----------------10.00------------19
7654321----------11223--------------7/5/2008-----------Adjustment from last billing cycle-----23543556-------------------A--------------------50.00--------------19
4653456----------11223--------------7/5/2008-----------paid for cleaning------------------------35654765--------------------I---------------------30.00-------------19
Please Ignore '----', added it for clarity
I am trying to write a query to aggregate paid_amount based on Reference_No, Check_Number, Payment_Date, Invoice_Number, Invoice_Type, Vendor_Number and display description with Invoice_type 'I' when there are multiple records with the same Reference_No, Check_Number, Payment_Date, Invoice_Number, Invoice_Type, Vendor_Number. When there are no multiple records I want to display the respective Description.
The query should return the following data set
Reference_No---Check_Number---Check_Date--------Description-------------------------------Invoice_Number----------Invoice_Type---Paid_Amount-----Vendor_Number
1234567----------11223-------------- 7/5/2008----------paid for cleaning----------------------44345563------------------I-----------------*10.00*------------19
7654321----------11223--------------7/5/2008-----------Adjustment from last billing cycle-----23543556-------------------A--------------------50.00--------------19
4653456----------11223--------------7/5/2008-----------paid for cleaning------------------------35654765-------------------I---------------------30.00--------------19
The following is my query. I am kind of lost.
select B.Description, A.sequence_id,A.check_date, A.check_number, A.invoice_number, A.amount, A.vendor_number
from (
select sequence_id,check_date, check_number, invoice_number, sum(paid_amount) amount, vendor_number
from INVOICE
group by sequence_id,check_date, check_number, invoice_number, vendor_number
) A, INVOICE B
where A.sequence_id = B.sequence_id
Thanks,
Nick

It looks like it is a duplicate thread - correct me if i'm wrong in this case ->
Need help with SQL Query with Inline View + Group by
Regards.
Satyaki De.

Similar Messages

  • Need help qith sql query

    I have a table with Columns as as below
    id number primary key
    object_name varchar2(100)
    object_value varchar2(100)
    Data is stored as follows
    id object_name object_value
    10 prop_num 436
    20 city dallas
    40 Misc 1 90
    50 Misc 1 desc min amount
    60 Misc 2 700
    70 Misc 2 desc interest amount
    80 Misc 3
    80 Misc 3 desc
    SQL should return result as shown below
    id object_name object_value
    10 prop_num 436
    20 city dallas
    40 min amount 90
    50 interest amount 700
    I have done this through plsql code by creating temp table. But I need to do it in a sql query. I am stuck here
    Any pointers/help is appreciated
    Thanks
    Edited by: user9327712 on Mar 11, 2010 8:14 AM

    I have a table where the ids are stored.
    *"object name"* column values are actually another table columns stored as rows here. So in our example prop_num, city,Misc 1, Misc 1 desc, Misc 2, Misc 2
    desc,Misc 3 , Misc 3 desc are all columns. These would not change any time
    The column object_value has values stored for respective columns.
    436, dallas , 90 , min amount , 700 , interest amount are all column values. So these can change.
    id object_name object_value
    10 prop_num 436
    20 city dallas
    40 Misc 1 90
    50 Misc 1 desc min amount
    60 Misc 2 700
    70 Misc 2 desc interest amount
    80 Misc 3
    90 Misc 3 desc
    Edited by: user9327712 on Mar 11, 2010 9:57 AM
    Edited by: user9327712 on Mar 11, 2010 10:00 AM
    Edited by: user9327712 on Mar 11, 2010 10:00 AM

  • Complete novice needs help getting SQL Query into Crystal Reports XI

    Post Author: MissMarnie
    CA Forum: Data Connectivity and SQL
    So I was given an intro level web course and a monster reference guide in prep to format a report. One of our developers wrote me everything I need for the report into a SQL Query and now I'm supposed to format it in CR XII literally do not know what to do from here. I'm able to set up the correct server as a datasource, if that's useful, but I don't know how to make the querey into a bunch of formattable fields in  CR. If anyone can walk me through this, I'd be so grateful. I've attempted to look up SQL query in both the help and the book but I keep hitting a wall. The help dialog says things like "press this button" with no reference to what "this button" is. I'm sure it's obvious to the knowledgeable but I'm in a complete fog. Thanks in advance   

    Post Author: synapsevampire
    CA Forum: Data Connectivity and SQL
    IF you're trying to get assistance with setting up a query as the source for a report, try posting your Crystal version and the database type.
    Different software works differently.
    In CR 9 and above, under the connection to the database you'll see Add Command. Select that and you can paste the query in.
    As for not knowing how to generate a report, that requires experience, there's no generic solution of course..
    -k

  • Issue with SQL Query with Presentation Variable as Data Source in BI Publisher

    Hello All
    I have an issue with creating BIP report based on OBIEE reports which is done using direct SQL. There is this one report in OBIEE dashboard, which is written using direct SQL. To create the pixel perfect version of this report, I am creating BIP data model using SQL Query as data source. The physical query that is used to create OBIEE report has several presentation variables in its where clause.
    select TILE4,max(APPTS), 'Top Count' from
    SELECT c5 as division,nvl(DECODE (C2,0,0,(c1/c2)*100),0) AS APPTS,NTILE (4) OVER ( ORDER BY nvl(DECODE (C2,0,0,(c1/c2)*100),0))  AS TILE4,
    c4 as dept,c6 as month FROM 
    select sum(case  when T6736.TYPE = 'ATM' then T7608.COUNT end ) as c1,
         sum(case  when T6736.TYPE in ('Call Center', 'LSM') then T7608.CONFIRMED_COUNT end ) as c2,
         T802.NAME_LEVEL_6 as c3,
         T802.NAME_LEVEL_1 as c4,
         T6172.CALENDARMONTHNAMEANDYEAR as c5,
         T6172.CALENDARMONTHNUMBERINYEAR as c6,
         T802.DEPT_CODE as c7
    from
         DW_date_DIM T6736 /* z_dim_date */ ,
         DW_MONTH_DIM T6172 /* z_dim_month */ ,
         DW_GEOS_DIM T802 /* z_dim_dept_geo_hierarchy */ ,
         DW_Count_MONTH_AGG T7608 /* z_fact_Count_month_agg */
    where  ( T802.DEpt_CODE = T7608.DEPT_CODE and T802.NAME_LEVEL_1 =  '@{PV_D}{RSD}' 
    and T802.CALENDARMONTHNAMEANDYEAR = 'July 2013'
    and T6172.MONTH_KEY = T7608.MONTH_KEY and T6736.DATE_KEY = T7608.DATE_KEY
    and (T6172.CALENDARMONTHNUMBERINYEAR between substr('@{Month_Start}',0,6)  and substr('@{Month_END}',8,13))
    and (T6736.TYPE in ('Call Center', 'LSM')) )
    group by T802.DEPT_CODE, T802.NAME_LEVEL_6, T802.NAME_LEVEL_1, T6172.CALENDARMONTHNAMEANDYEAR, T6172.CALENDARMONTHNUMBERINYEAR
    order by c4, c3, c6, c7, c5
    ))where tile4=3 group by tile4
    When I try to view data after creating the data set, I get the following error:
    Failed to load XML
    XML Parsing Error: mismatched tag. Expected: . Location: http://172.20.17.142:9704/xmlpserver/servlet/xdo Line Number 2, Column 580:
    Now when I remove those Presention variables (@{PV1}, @{PV2}) in the query with some hard coded values, it is working fine.
    So I know it is the PV that's causing this error.
    How can I work around it?
    There is no way to create equivalent report without using the direct sql..
    Thanks in advance

    I have found a solution to this problem after some more investigation. PowerQuery does not support to use SQL statement as source for Teradata (possibly same for other sources as well). This is "by design" according to Microsoft. Hence the problem
    is not because different PowerQuery versions as mentioned above. When designing the query in PowerQuery in Excel make sure to use the interface/navigation to create the query/select tables and NOT a SQL statement. The SQL statement as source works fine on
    a client machine but not when scheduling it in Power BI in the cloud. I would like to see that the functionality within PowerQuery and Excel should be the same as in Power BI in the cloud. And at least when there is a difference it would be nice with documentation
    or more descriptive errors.
    //Jonas 

  • Need help in SQL Query: Update a row in a table & insert the same row into another table

    I want to update a row in a table say Table A and the updated row should be inserted into another table say Table B. I need to do it in a single SQL query and i don't want to do it in PL/SQL with triggers. And i tried with MERGE statement but its working with this scenario. (Note: I'm using Oracle Database 10g Enterprise Edition Release 10.2.0.1.0).
    Thanks in Advance.

    Using Sven's code as an example, you could save the updated row in a sql plus variable. (also untested):
    SQL> var v_id number
    update tableA  
    set colB='ABC' 
    where colC='XYZ' 
    returning id into :v_id;
    insert into table A_History (ID, colA, colB, ColC)  
    select id, ColA, ColB, ColC  
    from tableA  
    where id = :v_id;   

  • Need help writing sql query

    i am trying to write sql query for a single recordset.
    I have an items table with all the standard item info and an item_colorID.
    i have a color_lookup table with 2 columns, item_colorID and color_ID
    i have a colors table with 2 columns, color_ID and color
    i want to join the tables and filter it so that a repeat region shows dynamic data of item name, description, thumb, price
    and also a list/menu dynamically populated by color
    filtered so that each item shows in the list/menu only the colors that the item has available.
    i have tried different variations of this sql
    SELECT * FROM items INNER JOIN color_lookup ON color_lookup.item_colorID = items.item_colorID INNER JOIN colors ON colors.color_ID = color_lookup.color_ID WHERE items.itemCatID = 3 ORDER BY items.itemName
    but the list/menu shows every color choice multiplied by the number of items in that color
    ie  White will show 80+ times.
    thanks for your help,
    jim balthrop

    bregent,
    thanks for your help.
    I am building a shopping cart and i have a recordset to list the items and a repeat region for that recordset
    i have a second recordset for the colors joined to the item_colorID nested inside the repeat region.
    the shopping cart software has a 'lookup from recordset' choice for the add to cart servior behavior
    and then i bind to the columns on the cart page.
    it produces this code
    if (isset($totalRows_rs_itemscat3) && $totalRows_rs_itemscat3 > 0)    {
        $row_rs_itemscat3 = WAEC_findRecordMySQL($rs_itemscat3, "item_ID", $ATC_itemID);
        if ($row_rs_itemscat3)    {
          $ATC_itemName = "".$row_rs_itemscat3['itemName']  ."";// column binding
          $ATC_itemDescription = "".$row_rs_itemscat3['itemShortDesc']  ."";// column binding
          $ATC_itemWeight = floatval("".$row_rs_itemscat3['itemWeight']  ."");// column binding
          $ATC_itemQuantity = "".$_POST["Farrington_1_Quantity_Add"]  ."";// column binding
          $ATC_itemPrice = floatval("".$row_rs_itemscat3['itemPrice']  ."");// column binding
          $ATC_itemThumbnail = "".$row_rs_itemscat3['itemThumb']  ."";// column binding
          $ATC_itemcolorchoice = "".$row_rs_colors['color']  ."";// column binding
          mysql_data_seek($rs_itemscat3, 0);
          $row_rs_itemscat3 = mysql_fetch_assoc($rs_itemscat3);
    the column binding for the colors is from a different recordset and when redirecting to the cart page the color info will not show.
    So my thinking is if i could get the color list/menu to populate from the same recordset as the item listing, it would solve my add to cart server behavior.
    Is it possible to do this with only one recordset?
    the products page and the cart page can be seen
    http://www.farrington-enterprises.com/rain-gutters.php
    add an item to the cart with any color choice and the color info does not carry to the cart.

  • Need help regarding sql query

    hii All
    I need help for pl/sql function.
    I build a function for monthly attendance all employees.
    but now i want to show all Sundays with 'S' and others respectively 'P' and 'A'.
    Currently Sunday also shows 'A'
    So please help
    SQL queries ... like
    SELECT DISTINCT AL.USERNAME,
    CASE WHEN DAY1 =1 THEN 'P' ELSE 'A' END DAY1,
    CASE WHEN DAY2 =1 THEN 'P' ELSE 'A' END DAY2,
    CASE WHEN DAY3 =1 THEN 'P' ELSE 'A' END DAY3,
    CASE WHEN DAY31 =1 THEN 'P' ELSE 'A' END DAY31
    FROM
    SELECT DISTINCT USERNAME, SUM(CASE WHEN
    fromdt=TRUNC(L.LOGIN_DATE) THEN
    1
    ELSE
    0
    END) DAY1
    ,SUM(CASE WHEN
    fromdt +1=TRUNC(L.LOGIN_DATE) THEN
    1
    ELSE
    0
    END) DAY2,
    SUM(CASE WHEN
    fromdt+30=TRUNC(L.LOGIN_DATE) THEN
    1
    ELSE
    0
    END) DAY31
    FROM ( SELECT DISTINCT TRUNC(LOGIN_DATE)LOGIN_DATE ,USERNAME FROM FCDM_AUDIT_TRAIL_NEW WHERE
    TRUNC(LOGIN_DATE) BETWEEN fromdt AND todt
    -- to_date( login_date, 'dd-mom-yyyy') between to_date( fromdt, 'dd-mom-yyyy') and to_date( todt, 'dd-mom-yyyy')
    ) L
    GROUP BY USERNAME
    ) AL;
    how can i show matched Sundays and show with 'SUN' or 'S'
    Regards
    vij..

    Try this way:
    SELECT USERNAME,
           MAX(CASE WHEN to_char(fromdt,'d')='1' and fromdt=TRUNC(L.LOGIN_DATE) THEN 'S'
                    WHEN to_char(fromdt,'d')!='1' and fromdt=TRUNC(L.LOGIN_DATE) THEN 'P'
                    ELSE 'A') DAY1,
           MAX(CASE WHEN to_char(fromdt+1,'d')='1' and fromdt+1=TRUNC(L.LOGIN_DATE) THEN 'S'
                    WHEN to_char(fromdt+1,'d')!='1' and fromdt+1=TRUNC(L.LOGIN_DATE) THEN 'P'
                    ELSE 'A') DAY2,
           MAX(CASE WHEN to_char(fromdt+30,'d')='1' and fromdt+30=TRUNC(L.LOGIN_DATE) THEN 'S'
                    WHEN to_char(fromdt+30,'d')!='1' and fromdt+30=TRUNC(L.LOGIN_DATE) THEN 'P'
                    ELSE 'A') DAY31
    FROM
    (SELECT DISTINCT TRUNC(LOGIN_DATE) LOGIN_DATE,
            USERNAME
       FROM FCDM_AUDIT_TRAIL_NEW
      WHERE TRUNC(LOGIN_DATE) BETWEEN fromdt AND todt
    ) L
    Group by USERNAME
    ;Max
    http://oracleitalia.wordpress.com

  • Need Help in SQL Query

    Hi all,
    I have data in the following manner:
    CASE_NUMBER HOURS FLAG
    1000 10 0
    1000 20 0
    1000 30 1
    1000 40 0
    1000 50 1
    Here I need to Calculate the total hours for a Case_number till i see the flag as 1.
    Here the result must be 10+20+30 Hrs
    Another Example
    CASE_NUMBER HOURS FLAG
    2000 10 1
    2000 20 1
    Here the result must be only 10.
    I am struggling to write a SQL query for this.
    Anyones help will be very much greatful
    Thanks in Advance
    Regards,
    Sengathir Subbarayan

    Look up analytical functions.
    something like sum(hours) OVER (PARTITION BY case_number ORDER BY something)
    will give you the sum for all rows.
    Then you probably want to "throw away" those rows after the flag maybe by summing the flag column too, and throw away all those where the flag is greater than 1 and where it is equal to 1 except for the first one.
    I suspect you actually have some other column (other than the number of hours) that define your order - that's what you put in the ORDER BY.
    Jon

  • Help with sql query on materialized view logs

    I am in need of a query to find out what tablespace and snap shot site a long list of materialized view logs are associated with.
    something like below except tablespace and snap_shot_site are not an option for this table.
    select log_owner, master, log_table, tablespace, snap_shot_site from dba_mview_logs;

    What is the refresh method set as?
    Could you paste the full MV log creation script and the corresponding MV creation script.

  • Need help Designing a Query -with RKFs and CKF or alternate

    Hi,
    Trying to create a query off a HR Headcount IC - to display number of top performing employees (based on appraisal attribute) by region and by function. The format is as follows:
    Created 3 RKF's in column structure where
    1RKF is KF "Employee Numbers" for characteristics restrictions of date range1, appraisal rating=1,2, employee status =active etc.
    2RKF is KF "Employee Numbers" for characteristics restrictions of date range1, appraisal rating=#, employee status =active etc.
    3RKF is KF "Employee Numbers" for characteristics restrictions of date range2, appraisal rating=1,2, employee status =active etc.
    1CKF is Boolean result of (1RKF OR (2RKF AND 3RKF)
    Was able to display correctly all top performing employees in the following format. When "Employee" was selected to row.
    Top Performer (CKF)
    Employee 1----
    1
    Employee 2----
    1
    Employee 3----
    1
    Employee 4----
    1
    Employee 5----
    1
    Employee 6----
    1
    Employee 7----
    1
    When tried to display the same by Region by Function or even by only Region (Row Char) it doesn’t work. Data is non-sensical.
    # of Top performers
    Region 1 -
    FunctionA----
    5
    Region 1 -
    FunctionB----
    2
    Region 1 -
    FunctionC----
    3
    Region 2 -
    FunctionA----
    4
    Region 2 -
    FunctionB----
    0
    Region 2 -
    FunctionC----
    7
    Region 2 -
    FunctionD----
    5
    Understand that the Boolean CKF is not working correctly. What am I doing wrong ? Please advice fix or alternates.
    Thanks.

    Hi Pradeep,
    not possible to use ranking since Appraisal rating is a characterstics not a key figure value. Any other suggestions..
    Thanks
    Arun

  • Need help in SQL query to get only distinct records

    Hi all.
    I am new to oracle SQL and i want to write a query to get only distinct values from 2 tables.
    for example i hade 2 tables table1(employee_id,employee_no,grade) and another table2 with same structure.
    for example data in table1 is
    Employeeid employeeno Grade
    1 101 A
    1 101 B
    1 101 E
    1 101 D
    and data in table 2 is
    Employeeid employeeno Grade
    1 101 A
    1 101 B
    1 101 E
    i want to display only the fourth row like the data that doesnt exist in table2 i,e (1 101 D)
    I had too much records in both tables and i jst want to see the records that is in table 1 not in table 2 only.
    employeeid and employeeno are the same in both tables
    I hope u understand my query. I user left outer join and right outer join bt it displays all the results that and matching and unmatching. I want jst unmatched records.
    Any help is highly Appreciated.
    Thanx in Advance.
    I am using oracle 10G on windows

    Try MINUS:
    http://download.oracle.com/docs/cd/B19306_01/server.102/b14200/queries004.htm#i2054381
    SQL> -- generating sample data:
    SQL> with t1 as (
      2  select 1 employeeid, 101 employeeno, 'A' grade from dual union
      3  select 1, 101, 'B' from dual union
      4  select 1, 101, 'E' from dual union
      5  select 1, 101, 'D' from dual
      6  )
      7  ,  t2 as (
      8  select 1 employeeid, 101 employeeno, 'A' grade from dual union
      9  select 1, 101, 'B' from dual union
    10  select 1, 101, 'E' from dual
    11  )
    12  --
    13  -- actual query:
    14  --
    15  select employeeid
    16  ,      employeeno
    17  ,      grade
    18  from   t1
    19  minus
    20  select employeeid
    21  ,      employeeno
    22  ,      grade
    23  from   t2;
    EMPLOYEEID EMPLOYEENO G
             1        101 D
    1 row selected.

  • Need help creating SQL Query

    Hi,
    I have this table
    declare @t_date table(cut_off datetime)
    insert into @t_date
    select '20140930'
    union
    select '20140716'
    union
    select '20140715'
    union
    select '20140714'
    union
    select '20140627'
    union
    select '20140625'
    I need this result: Dates nearests to end of month
    In the table on example, I need this output
    2014-09-30
    2014-07-16
    2014-06-27
    Can anyone help me?
    Thanks a lot in advance.
    declare @t_date table(cut_off datetime)
    insert into @t_date
    select '20140930' --this is OK cause eom
    union
    select '20140716' --this is OK cause is the nearest to eom(07)
    union
    select '20140715' --this is KO cause is not the nearest to eom(07)
    union
    select '20140714' --this is KO cause is not the nearest to eom(07)
    union
    select '20140627' --this is OK cause is the nearest to eom(06)
    union
    select '20140625' --this is KO cause is not the nearest to eom(06)

    Please post DDL, so that people do not have to guess what the keys, constraints, Declarative Referential Integrity, data types, etc. in your schema are. You have no keys! Learn how to follow ISO-11179 data element naming conventions and formatting rules.
    Temporal data should use ISO-8601 formats. It is the only –- repeat, only -– format allowed in ANSI/ISO Standard SQL! Code should be in Standard SQL as much as possible and not local dialect. We would use the correct INSERT INTO syntax. 
    Oh, that silly “t_” is called a “tibble” and we laugh at it. 
    CREATE TABLE Foobar_Dates
    (foobar_date DATE NOT NULL PRIMARY KEY);
    INSERT INTO Foobar_Dates
    VALUES
    ('2014-06-25'),
    ('2014-06-27'),
    ('2014-07-14'),
    ('2014-07-15'),
    ('2014-07-16'),
    ('2014-09-30'),
    >> I need this result: for each month I need the date nearest to end of month <<
    Since SQL is a database language, we prefer to do look ups and not calculations. They can be optimized while temporal math messes up optimization. A useful idiom is a report period calendar that everyone uses so there is no way to get disagreements in the DML.
    Build good tools and re-use them! 
    The report period table gives a name to a range of dates that is common to the entire enterprise. 
    CREATE TABLE Month_Periods
    (month_name CHAR(10) NOT NULL PRIMARY KEY
       CHECK (month_name LIKE '[12][0-9][0-9][0-9]-[01][0-9]-00'),
     month_start_date DATE NOT NULL,
     month_end_date DATE NOT NULL,
      CONSTRAINT date_ordering
        CHECK (month_start_date < month_end_date),
    etc);
    These report periods can overlap or have gaps. I like the MySQL convention of using double zeroes for months and years, That is 'yyyy-mm-00' for a month within a year and 'yyyy-00-00' for the whole year. The advantages are that it will sort with the ISO-8601
    data format required by Standard SQL and it is language independent. 
    SELECT M.month_name, MAX(F.foobar_date), 
           OVER (PARTITION BY M.month_name)
      FROM Foobar_Dates AS F, 
           Month_Periods AS M 
     WHERE F.foobar_date BETWEEN M.month_start_date AND M.month_end_date;
    --CELKO-- Books in Celko Series for Morgan-Kaufmann Publishing: Analytics and OLAP in SQL / Data and Databases: Concepts in Practice Data / Measurements and Standards in SQL SQL for Smarties / SQL Programming Style / SQL Puzzles and Answers / Thinking
    in Sets / Trees and Hierarchies in SQL

  • Need Help on Sql Query

    Hi,
    I have a client requirement to show a report on the device availability. The report should show the output as
    Node Availability%
    Formula for Availability = (Total No. of Failed/Total No. rows) * 100
    My Oracle Table has the following data
    NODE     SUMMARY
    172.16.10.55     Default Interface Ping fail for 172.16.10.55: ICMP timeout
    172.16.10.55     Default Interface Ping restore for 172.16.10.55
    172.16.10.55     Default Chassis Ping restore for 172.16.10.55
    172.16.10.55     Default Chassis Ping fail for 172.16.10.55: ICMP timeout
    172.16.10.55     Default Chassis Ping restore for 172.16.10.55
    172.16.10.55     Default Chassis Ping fail for 172.16.10.55: ICMP timeout
    172.16.10.55     Default Chassis Ping fail for 172.16.10.55: ICMP timeout
    172.16.10.55     Default Interface Ping restore for 172.16.10.55
    172.16.10.55     Default Interface Ping fail for 172.16.10.55: ICMP timeout
    172.16.10.56     Default Chassis Ping restore for 172.16.10.56
    172.16.10.56     Default Interface Ping fail for 172.16.10.56: ICMP timeout
    172.16.10.56     Default Chassis Ping fail for 172.16.10.56: ICMP timeout
    172.16.10.56     Default Chassis Ping restore for 172.16.10.56
    172.16.10.56     Default Chassis Ping fail for 172.16.10.56: ICMP timeout
    172.16.10.56     Default Chassis Ping restore for 172.16.10.56
    172.16.10.56     Default Chassis Ping restore for 172.16.10.56
    172.16.10.56     Default Interface Ping fail for 172.16.10.56: ICMP timeout
    In the above table the Summary column has the details like 'Ping fail' , 'Ping restore' for each Node. So, for each Node I have to compute the Total Ping Fail / (Total Ping Fail + Ping Restore) * 100 to compute the availability %.
    My output should be like the below
    Node Availability%
    172.16.10.55 55.55
    172.16.10.56 54
    Can someone please help me with query.
    I appreciate your help in advance.
    Thanks.
    Regards,
    RaviShankar.

    My Oracle Table has the following dataThat's great, but if you want maximum response to your question, then post CREATE TABLE + INSERT INTO statements.
    I currently do not have the time to turn your data into them.
    And always post the database version you're using.
    http://tkyte.blogspot.com/2005/06/how-to-ask-questions.html
    Also use the {noformat}{noformat} tag in order to post examples that benefit from staying formatted and thus readable when posted on the forum.
    Simply put the tag before and after your examples.
    For example, when you type:
    {noformat}select *
    from dual;{noformat}
    it will appear as:select *
    from dual;                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   

  • Need Help Reg SQL Query

    Hi,
    I Have a table with below structure
    Change_Type Old_Val New_val
    AB 1 2
    BC 11 12
    AB 21 22
    BC 31 32
    CD 41 42
    CD 51 52
    Requirement is to display the records in following fashion.
    AB 1 2
    BC 11 12
    CD 41 42
    AB 21 22
    BC 31 32
    CD 51 52

    try this
    with t as
    select 'AB' a, 1 b, 2 c from dual
    union
    select 'BC' a, 11 b,12 c from dual
    union
    select 'AB' a, 21 b,22 c from dual
    union
    select 'BC' a, 31 b,32 c from dual
    union
    select 'CD' a, 41 b,42 c from dual
    union
    select 'CD' a, 51 b,52 c from dual
    select a,b,c from(select a, b, c, row_number() over (partition by a order by b) rn from t) order by rn,a,b

  • Need help for SQL Query

    Hi Friends,
    I am using below query to genearet one report.
    {code}
    distinct a.plan_id,
    (SELECT external_plan_ref
    FROM bk9_t_plan
    WHERE plan_id = a.plan_id)
    "EXT_PAN_REF",
    (SELECT external_plan_ref
    FROM bk9_t_plan
    WHERE plan_id = b.depends_on_ba_plan_id)
    "EXT_PAN_REF1",
    (SELECT external_plan_ref
    FROM bk9_t_plan
    WHERE plan_id = c.drp_plan_id)
    "EXT_PAN_REF2",
    (SELECT external_plan_ref
    FROM bk9_t_plan
    WHERE plan_id = d.srp_plan_id)
    "EXT_PAN_REF3",
    (SELECT external_plan_ref
    FROM bk9_t_plan
    WHERE plan_id = e.DRP_TO_DRP_PLAN_ID)
    "EXT_PAN_REF4",
    (SELECT external_plan_ref
    FROM bk9_t_plan
    WHERE plan_id = f.srp_plan_id)
    "EXT_PAN_REF5"
    FROM BK9_T_BUSINESS_ACTIVITY a,
    BK9_T_BA_DEPENDENCY b,
    BK9_T_BA_DRP_DEP c,
    BK9_T_BA_SRP_DEP d,
    BK9_T_DRP_DEPENDENCY e,
    BK9_T_SYSTEM_DEPENDENCY f
    WHERE     a.plan_id = b.ba_to_ba_plan_id
    AND a.plan_id = c.ba_plan_id
    AND a.plan_id = d.ba_plan_id
    AND c.drp_plan_id = e.DRP_TO_DRP_PLAN_ID
    AND e.DRP_TO_DRP_PLAN_ID = f.drp_plan_id
    {code}
    My output is like this :
    {code}
    22767 19093 19095 19049  19049 19059
    22767 19093 19095 19049  19049 19060
    22767 19093 19095 19062  19062 19060
    22767 19093 19095 19062  19062 19061
    22768 19094 19093 19062  19062 19060
    22768 19094 19093 19062  19062 19061
    {code}
    But What i am looking is like this.
    {code}
    22767 19093 19095 19049  19049 19059
    22767                                               19060
    22767 19093 19095 19062  19062 19060
    22767                                              19061
    22768 19094 19093 19062 19062 19060
    22768                                              19061
    {code}
    Please help.

    Hi,
    Could you please illuminate our minds and spend a bit of time in explaining the logic? That will be much easier without reading the crystal ball which nobody has it here.
    Please read: Re: 2. How do I ask a question on the forums?
    And please provide sample data (create table and insert statement), description of the logic, database version and everything else which is specified in the FAQ
    Regards.
    Al

Maybe you are looking for

  • How to Handle the memory in JAVA??

    Hello, I created one Editor using swing concepts. And I am openeing a file ( 8MB ).For that I am using a Sting Buffer in my program ( for reading the file)...But If I open multiple files in my Editor .... its taking so much time.. so for that I have

  • Best Adobe product for editing PDF, replacing English text with Thai without altering/recompressing images, graphics etc.?

    I have an English language PDF, a medical device brochure, the content of which has already been translated into Thai (in Word). I want to replace the original English in the PDF with the Thai translation easily without altering any other aspect of t

  • Error occured while signing in

    Trying to convert a PDF file with my adobe exportPDF. when i hit convert it says "error occured while signing in"? What should I do?

  • Not able to use CONCAT in CDS View

    Hello, My requirement is to prepare a field by concatenating 'PR' in front of the field and use it in a CDS view. I am getting the below error while doing it. Is the issue with my HANA version or the code is wrong.

  • Project Server 2013 licenses in use

    Is there any way to retrieve the exact number of PWA and Project Pro licenses in use for a Project Server 2013 instance? In older versions you had the 'About Project Server' page and for 2010 there was a SQL script. But this script does not work for