Help in Query for max date

Hi, How I can get the max(Gst_date) record of GRD. IF record of GRD has more than one record then I need the one max(GST_date) record of every GRD. Thanks.
create table #CRT (CRT numeric, GRD numeric, GST_Date datetime)
insert into #CRT values (7 ,1900,'01-01-2000')
insert into #CRT values (19,1900,'01-01-2002')
insert into #CRT values (24,1900,'01-01-2013')
insert into #CRT values (7 ,2100,'01-01-2010')
insert into #CRT values (19,2100,'01-01-2012')
insert into #CRT values (7 ,2200,'01-01-2012')
insert into #CRT values (19,2200,'02-02-2012')
I would like the following output from query. The following record is the max(GST_Date ) of every '''GRD'".
CRT   GRD   GST_Date
24    1900  01-01-2013
19    2100  01-01-2012
19    2200  02-02-2012

Please follow basic Netiquette and post the DDL we need to answer this. Follow industry and ANSI/ISO standards in your data. You should follow ISO-11179 rules for naming data elements. Everything you posted is wrong. You should follow ISO-8601 rules for
displaying temporal data. In fact is is required by ANSI/ISO Standards. You failed again. We need to know the data types, keys and constraints on the table. Avoid dialect in favor of ANSI/ISO Standard SQL. You need to read and download the PDF for: 
https://www.simple-talk.com/books/sql-books/119-sql-code-smells/
Please, please learn why rows are not records. You do not even know what a key is or how to write a INTEGER NOT NULL(s, p) declaration. Allowing a table and column to have the same name is legal syntax and we regret not taking it out of the Standard. It is
stupid! How can a set also be an attribute of itself? But your DDL gave no attribute  properties, as per ISO-11179. 
Here is my attempt at repairs
CREATE TABLE CRT 
(crt_something INTEGER NOT NULL, 
 grd_something INTEGER NOT NULL, 
 PRIMARY KEY (crt_something, grd_something),
 gst_date DATE NOT NULL);
Here is how we write an insertion statement; you are still using Sybase syntax! Why did you pick the most ambiguous, non-ANSI date display format? 
INSERT INTO CRT 
VALUES 
 ( 7, 1900, '2000-01-01), 
 ( 7, 2100, '2010-01-01'), 
 ( 7, 2200, '2012-01-01'), 
 (19, 1900, '2002-01-01'), 
 (19, 2100, '2012-01-01'), 
 (19, 2200, '2012-02-02'),
 (24, 1900, '2013-01-01');
>> How I can get the MAX(gst_date) record [sic] of grd_something. If record [sic] of grd_something has more than one record [sic] then I need the one MAX(gst_date) record [sic] of every grd_something. <<
WITH X
(SELECT crt_something, grd_something, gst_date,
        MAX(gst_date) 
          OVER (PARTITION BY grd_something) AS gst_date_max
  FROM CRT)
 SELECT *
   FROM X
  WHERE gst_date_max = gst_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

Similar Messages

  • Query For Max(amt_financed)

    Hi Dears,
    I want a select query for max of amount_financed for a particular customer
    having same max(amount_financed) for more than one contracts. Also i want only one contract with max amount financed
    Note :- one customer can have more than one contract
    exm:
    select distinct con_number,max(amount_finc) amt,customer from a
    group by con_number,customer;
    con_number amt customer
    10 1000 a1
    11 1000 a1
    12 777 a1
    13 250 a2
    in above data i need only one record
    i.e
    con_number amt customer
    10 1000 a1

    10 1000 a1
    11 1000 a1You get two contract numbers when for the maximum amount.
    in above data i need only one record
    10 1000 a1 Based on what condition you need only one record ??
    Is this you wanted?
    SQL> create table test (con_number number, amt number, customer varchar2(10));
    Table created.
    SQL> insert into test values(10, 1000, 'a1');
    1 row created.
    SQL> insert into test values(11, 1000, 'a1');
    1 row created.
    SQL> insert into test values(12, 777, 'a1');
    1 row created.
    SQL> insert into test values(13, 250, 'a2');
    1 row created.
    SQL> commit;
    Commit complete.
    SQL> select * from test;
    CON_NUMBER        AMT CUSTOMER
            10       1000 a1
            11       1000 a1
            12        777 a1
            13        250 a2
    SQL> select * from test
      2   where amt in (select max(amt) from test);
    CON_NUMBER        AMT CUSTOMER
            10       1000 a1
            11       1000 a1

  • Query for inserting data into table and incrementing the PK.. pls help

    I have one table dd_prohibited_country. prohibit_country_key is the primary key column.
    I have to insert data into dd_prohibited_country based on records already present.
    The scenario I should follow is:
    For Level_id 'EA' and prohibited_level_id 'EA' I should retreive the
    max(prohibit_country_key) and starting from the maximum number again I have to insert them
    into dd_prohibited_country. While inserting I have to increment the prohibit_country_key and
    shall replace the values of level_id and prohibited_level_id.
    (If 'EA' occurs, I have to replace with 'EUR')
    For Instance,
    If there are 15 records in dd_prohibited_country with Level_id 'EA' and prohibited_level_id 'EA', then
    I have to insert these 15 records starting with prohibit_country_key 16 (Afetr 15 I should start inserting with number 16)
    I have written the following query for this:
    insert into dd_prohibited_country
    select     
         a.pkey,
         b.levelid,
         b.ieflag,
         b.plevelid
    from
         (select
              max(prohibit_country_key) pkey
         from
              dd_prohibited_country) a,
         (select
    prohibit_country_key pkey,
              replace(level_id,'EA','EUR') levelid,
              level_id_flg as ieflag,
              replace(prohibited_level_id,'EA','EUR') plevelid
         from
              dd_prohibited_country
         where
              level_id = 'EA' or prohibited_level_id = 'EA') b
    My problem here is, I am always getting a.pkey as 15, because I am not incrementing it.
    I tried incrementing it also, but I am unable to acheive it.
    Can anyone please hepl me in writing this query.
    Thanks in advance
    Regards
    Raghu

    Because you are not incrementing your pkey. Try like this.
    insert
       into dd_prohibited_country
    select a.pkey+b.pkey,
         b.levelid,
         b.ieflag,
         b.plevelid
       from (select     max(prohibit_country_key) pkey
            from dd_prohibited_country) a,
         (select     row_number() over (order by prohibit_country_key)  pkey,
              replace(level_id,'EA','EUR') levelid,
              level_id_flg as ieflag,
              replace(prohibited_level_id,'EA','EUR') plevelid
            from     dd_prohibited_country
           where level_id = 'EA' or prohibited_level_id = 'EA') bNote: If you are in multiple user environment you can get into trouble for incrementing your PKey like this.

  • Query to select value for max date from a varchar field containing year and month

    I'm having trouble selecting a value from a table that contain a varchar column in YYYY-MM format. 
    ex.
    Emp_id Date Cost
    10264 2013-01 5.00
    33644 2013-12 84.00
    10264 2013-02 12.00
    33644 2012-01 680.0
    59842 2014-05 57.00
    In the sample data above, I would like to be able to select the for each Emp_id by the max date. Ex. For Emp_id 10264, the cost should be 12.00.

    create table test (Emp_id int, Date varchar(10), Cost decimal (6,2))
    insert into test values(
    10264, '2013-01', 5.00 ),
    (33644, '2013-12', 84.00 ),
    (10264, '2013-02', 12.00 ),
    (33644, '2012-01', 680.0 ),
    (59842, '2014-05', 57.00 )
    Select Emp_id,[Date],Cost FROM (
    select *,row_number() Over(Partition by Emp_id Order by Cast([Date]+'-1' as Datetime) Desc) rn
    from test)
    t
    WHERE rn=1
    drop table test

  • Query for finding data during special holidays

    Hi, i have a table for special holidays that looks like this:
    PROFILE_DAY
    VAR_DATE
    REGULAR_HOLIDAY
    1/1/2013
    H_WEEK_THURSDAY
    3/28/2013
    H_WEEK_FRIDAY
    3/29/2013
    REGULAR_HOLIDAY
    12/24/2013
    REGULAR_HOLIDAY
    12/25/2013
    REGULAR_HOLIDAY
    12/31/2013
    And another table (LOAD_PROFILE_TEST), which contains LOAD_PROF1 values from (TIME_EQ) 0 to 24 at intervals 0.25 for (PROFILE_DAY) MONDAY to SUNDAY including REGULAR_HOLIDAY, H_WEEK_THURSDAY and H_WEEK_FRIDAY.  All in all, this table contains 970 records (97 records between 0 to 24 with interval of 0.25 per PROFILE_DAY, with 10 distinct PROFILE_DAY).
    TIME_EQ
    PROFILE_DAY
    LOAD_PROF1
    LOAD_PROF2
    0
    REGULAR_HOLIDAY
    11.47
    0.25
    REGULAR_HOLIDAY
    11.27
    0.5
    REGULAR_HOLIDAY
    11.3
    0.75
    REGULAR_HOLIDAY
    11.08
    0
    MONDAY
    11.27
    0.25
    MONDAY
    11.33
    0.5
    MONDAY
    11.18
    Now, I have this query to update value of LOAD_PROF2 of the said table whenever parameters V_DATE_OUT & V_DATE_IN is entered:
    UPDATE LOAD_PROFILE_TEST
         SET LOAD_PROF2 = LOAD_PROF1 + :LOAD_DIFF
         WHERE  UPPER(PROFILE_DAY) IN (select UPPER(to_char(:V_DATE_OUT + (level-1), 'fmDAY'))
                       from  dual
                       connect by level <=  :V_DATE_IN - :V_DATE_OUT  + 1
    where :LOAD_DIFF is a certain pre-determined value.
    This query works fine if i am trying to update regular days from MONDAY to SUNDAY.  What i would like to do is to determine if the two parameter dates, V_DATE_OUT & V_DATE_IN would fall under any of the holidays on the first table LOAD_PROFILE_TEST, then update only those rows.  For example, V_DATE_OUT = 12/02/2013, Monday and V_DATE_IN = 12/06/2013, Friday.  The query above would update the values of LOAD_PROF2 for PROFILE_DAY -  MONDAY to FRIDAY, corresponding to dates 12/02/2013 and 12/06/2013.  If however, V_DATE_OUT = 12/23/2013, Monday and V_DATE_IN = 12/27/2013, Friday, this should update the rows corresponding to PROFILE_DAY - MONDAY for 12/23/2013, THURSDAY for 12/26/2013, FRIDAY for 12/27/2013, and REGULAR_HOLIDAY for the dates 12/24/2013 and 12/25/2013 since these two are included in the first table (table of holidays).  This same scenario will work the same way when V_DATE_OUT  and/or V_DATE_IN fall in the dates 3/28/2013 and 3/29/2013.  All other dates not included in the table for special holidays will be treated according to the day they fall on (Monday thru Sunday).  I hope my point is clear.  Thank you in advance.

    Thanks for your reply.  Firstly, I am using Forms [32 Bit] Version 10.1.2.0.2 (Production).  I will try to explain a little further but I don't know if i can give the exact details of the tables since this would be voluminous. First i have a table REG_HOLIDAYS, whcih contain the following:
    PROFILE_DAY
    VAR_DATE
    REGULAR_HOLIDAY
    1/1/2013
    H_WEEK_THURSDAY
    3/28/2013
    H_WEEK_FRIDAY
    3/29/2013
    REGULAR_HOLIDAY
    12/24/2013
    REGULAR_HOLIDAY
    12/31/2013
    REGULAR_HOLIDAY
    12/25/2013
    Now i have another table LOAD_PROFILE_TEST which i will simplify just to show what i wanted to do:
    CREATE
    TABLE LOAD_PROFILE_TEST
    TIME_EQ
    NUMBER (5, 2),
    PROFILE_DAY
    VARCHAR2 (15 BYTE),
    LOAD_PROF1
    NUMBER (6, 2), 
    LOAD_PROF2
    NUMBER (6, 2)
    Here are the sample values of this table:
    TIME_EQ
    PROFILE_DAY
    LOAD_PROF1
    LOAD_PROF2
    0
    Monday
    2
    0
    Tuesday
    2.1
    0
    Wednesday
    2.3
    0
    Thursday
    2.5
    0
    Friday
    2.2
    0
    Saturday
    2.4
    0
    Sunday
    2.3
    0
    Regular_holiday
    1.9
    0.25
    Monday
    2.1
    0.25
    Tuesday
    2.1
    0.25
    Wednesday
    2.4
    0.25
    Thursday
    2.2
    0.25
    Friday
    2.5
    0.25
    Saturday
    2.3
    0.25
    Sunday
    2.3
    0.25
    Regular_holiday
    2.5
    However, in the actual table, TIME_EQ will start with 0 until 24 with interval of 0.25 (i.e 0, 0.25, 0.5, 0.75, 1, 1.25, 1.5, ...23.5, 23.75, 24).  So for a PROFILE_DAY of 'Monday', there will be 97 rows corresponding to TIME_EQ of 0 to 24.  The same is true for Tuesday, Wednesday until Sunday including Regular_holiday.  All in all, this table would contain 776 rows.  LOAD_PROF1 values are random values initally inputted with PROFILE_DAY and TIME_EQ.
    The first goal is to UPDATE this table (LOAD_PROFILE_TEST) by updating the column LOAD_PROF2 by adding a certain parameter value, :LOAD_DIFF, say 0.1. Now, i will have two scenarios to show what i would like to happen.  First, i have two date parameters :V_DATE_OUT and :V_DATE_IN.
    First Case, V_DATE_OUT = 12/15/2013 (Monday); V_DATE_IN = 12/22/2013 (Sunday)
    I will have this query to update said table:
    UPDATE LOAD_PROFILE_TEST
           SET LOAD_PROF2 = LOAD_PROF1 + :LOAD_DIFF
       WHERE   UPPER(PROFILE_DAY) IN (select UPPER(
                                                                     to_char(
                                                                          :V_DATE_OUT + (level-1),
                                                                          'fmDAY'))
                                                                    from  dual
                                                     connect by level <=
                                                           :V_DATE_IN - :V_DATE_OUT  + 1);
    The output of this query would be:
    TIME_EQ
    PROFILE_DAY
    LOAD_PROF1
    LOAD_PROF2
    0
    Monday
    2
    2.1
    0
    Tuesday
    2.1
    2.2
    0
    Wednesday
    2.3
    2.4
    0
    Thursday
    2.5
    2.6
    0
    Friday
    2.2
    2.3
    0
    Saturday
    2.4
    2.5
    0
    Sunday
    2.3
    2.4
    0
    Regular_holiday
    1.9
    0.25
    Monday
    2.1
    2.2
    0.25
    Tuesday
    2.1
    2.2
    0.25
    Wednesday
    2.4
    2.5
    0.25
    Thursday
    2.2
    2.3
    0.25
    Friday
    2.5
    2.6
    0.25
    Saturday
    2.3
    2.4
    0.25
    Sunday
    2.3
    2.4
    0.25
    Regular_holiday
    2.5
    Since, 12/15/2013 up to 12/22/2013 is from Monday to Sunday without having a particular day included in the first table, REG_HOLIDAYS, therefore all the rows with Monday to Sunday are updated.
    Second Case, V_DATE_OUT = 12/23/2013 (Monday); V_DATE_IN = 12/29/2013 (Sunday)
    Take note that 12/24 and 12/25 are included in the first table, REG_HOLIDAYS, therefore i need a query so that this would be my output afterwards:
    TIME_EQ
    PROFILE_DAY
    LOAD_PROF1
    LOAD_PROF2
    0
    Monday
    2
    2.1
    0
    Tuesday
    2.1
    0
    Wednesday
    2.3
    0
    Thursday
    2.5
    2.6
    0
    Friday
    2.2
    2.3
    0
    Saturday
    2.4
    2.5
    0
    Sunday
    2.3
    2.4
    0
    Regular_holiday
    1.9
    2.0
    0.25
    Monday
    2.1
    2.2
    0.25
    Tuesday
    2.1
    0.25
    Wednesday
    2.4
    0.25
    Thursday
    2.2
    2.3
    0.25
    Friday
    2.5
    2.6
    0.25
    Saturday
    2.3
    2.4
    0.25
    Sunday
    2.3
    2.4
    0.25
    Regular_holiday
    2.5
    2.6
    As can be seen, since 12/23/2013 up to 12/29/2013 is from Monday to Sunday, rows with Monday upto Sunday should be updated, HOWEVER, since 12/24 and 12/25 which falls on a Tuesday and a Wednesday also were declared as holidays (included in the REG_HOLIDAYS table),  instead of updating rows with PROFILE_DAY of Tuesday and Wednesday, the query should instead update rows with Regular_holiday as PROFILE_DAY and leave as is the rows with Tuesday and Wednesday.  Additional note, days declared in the REG_HOLIDAYS table with PROFILE_DAY of Regular_holidays are treated as DISTINCT as in the case of 12/24 and 12/25.
    The query you gave me gives the correct value if the involved days between V_DATE_OUT and V_DATE_IN is from Monday to Sunday only, otherwise it always gives Regular_holiday only regardless of the other dates queried.  As in the first case above, it would give Monday to Sunday (correct) but for the second case, it will only give Regular_holiday, the other days (Monday, Thursday, Friday, Saturday and Sunday) was not outputted.
    I hope this became clearer since i will still be needing this for another query which i will inquire again after resolving this issue.  Thanks a lot for your help.

  • Trouble writing Query for Pivoting data from a table

    I am having a little trouble writing a query for converting the below table data into a pivot data. I am trying to write a query for which if I give a single valid report_week date as input it should give me the data for that week and also provide two extra columns, one which gives the data of last week for the same countries and the second column which gives the difference of numbers in both the columns(i.e. COUNT - COUNT_LAST_WEEK).
    REPORT_WEEK     DIVISION     COUNT
    9/26/2009     country1     81
    9/26/2009     country2     97
    9/26/2009     country3     12
    9/26/2009     country4     26
    9/26/2009     country5     101
    10/3/2009     country1     85
    10/3/2009     country2     98
    10/3/2009     country3     10
    10/3/2009     country4     24
    10/3/2009     country5     101
    10/10/2009     country1     84
    10/10/2009     country2     98
    10/10/2009     country3     10
    10/10/2009     country4     25
    10/10/2009     country5     102
    For example, if I give input as 10/10/2009, the output should be as give below.
    REPORT_WEEK     DIVISION     COUNT     COUNT_LAST_WEEK     DIFFERENCE
    10/10/2009     country1     84     85     -1
    10/10/2009     country2     98     98     0
    10/10/2009     country3     10     10     0
    10/10/2009     country4     25     24     1
    10/10/2009     country5     102     101     1
    For example, if I give input as 10/3/2009, the output should be as give below.
    REPORT_WEEK     DIVISION     COUNT     COUNT_LAST_WEEK     DIFFERENCE
    10/3/2009     country1     85     81     4
    10/3/2009     country2     98     97     1
    10/3/2009     country3     10     12     -2
    10/3/2009     country4     24     26     -2
    10/3/2009     country5     101     101     0
    Can anyone please shed some light on Query building for the above scenarios.
    Thank you
    SKP
    Edited by: user11343284 on Oct 10, 2009 7:53 AM
    Edited by: user11343284 on Oct 10, 2009 8:28 AM

    I assume there is no gap in report weeks. If so:
    SQL> variable report_week varchar2(10)
    SQL> exec :report_week := '10/10/2009'
    PL/SQL procedure successfully completed.
    with t as (
               select to_date('9/26/2009','mm/dd/yyyy') report_week,'country1' division,81 cnt from dual union all
               select to_date('9/26/2009','mm/dd/yyyy'),'country2',97 from dual union all
               select to_date('9/26/2009','mm/dd/yyyy'),'country3',12 from dual union all
               select to_date('9/26/2009','mm/dd/yyyy'),'country4',26 from dual union all
               select to_date('9/26/2009','mm/dd/yyyy'),'country5',101 from dual union all
               select to_date('10/3/2009','mm/dd/yyyy'),'country1',85 from dual union all
               select to_date('10/3/2009','mm/dd/yyyy'),'country2',98 from dual union all
               select to_date('10/3/2009','mm/dd/yyyy'),'country3',10 from dual union all
               select to_date('10/3/2009','mm/dd/yyyy'),'country4',24 from dual union all
               select to_date('10/3/2009','mm/dd/yyyy'),'country5',101 from dual union all
               select to_date('10/10/2009','mm/dd/yyyy'),'country1',84 from dual union all
               select to_date('10/10/2009','mm/dd/yyyy'),'country2',98 from dual union all
               select to_date('10/10/2009','mm/dd/yyyy'),'country3',10 from dual union all
               select to_date('10/10/2009','mm/dd/yyyy'),'country4',25 from dual union all
               select to_date('10/10/2009','mm/dd/yyyy'),'country5',102 from dual
    select  max(report_week) report_week,
            division,
            max(cnt) keep(dense_rank last order by report_week) cnt_this_week,
            max(cnt) keep(dense_rank first order by report_week) cnt_last_week,
            max(cnt) keep(dense_rank last order by report_week) - max(cnt) keep(dense_rank first order by report_week) difference
      from  t
      where report_week in (to_date(:report_week,'mm/dd/yyyy'),to_date(:report_week,'mm/dd/yyyy') - 7)
      group by division
      order by division
    REPORT_WE DIVISION CNT_THIS_WEEK CNT_LAST_WEEK DIFFERENCE
    10-OCT-09 country1            84            85         -1
    10-OCT-09 country2            98            98          0
    10-OCT-09 country3            10            10          0
    10-OCT-09 country4            25            24          1
    10-OCT-09 country5           102           101          1
    SQL> exec :report_week := '10/3/2009'
    PL/SQL procedure successfully completed.
    SQL> /
    REPORT_WE DIVISION CNT_THIS_WEEK CNT_LAST_WEEK DIFFERENCE
    03-OCT-09 country1            85            81          4
    03-OCT-09 country2            98            97          1
    03-OCT-09 country3            10            12         -2
    03-OCT-09 country4            24            26         -2
    03-OCT-09 country5           101           101          0
    SQL> SY.

  • SQL Query for max values!!

    Hi to all,
    I have four tables
    Tbl_one
    Tbl_two
    Tbl_three
    Tbl_four
    the relation between these tables is
    Tbl_one.SEQ = Tbl_two.SEQ)
    and tbl_two.case_SEQ = Tbl_four.SEQ
    AND Tbl_two.ORDER_SEQ = tbl_three.SEQ))
    I want a query like this
    Select tbl_one.com_name, tbl_three.test_date,tbl_four.order_date
    from Tbl_one,Tbl_two,Tbl_three,Tbl_four
    where Tbl_one.SEQ = Tbl_two.SEQ)
    and tbl_two.case_SEQ = Tbl_four.SEQ
    AND Tbl_two.ORDER_SEQ = tbl_three.SEQ))
    and tbl_three.test_date in (select max(test_date) from tbl_three)
    and tbl_four.order_date in select(max(order_date from tbl_for)
    and max(test_date)> Max(order_date)
    any way it is possible?
    the real problem is there are multiple test_dates and
    multiple order_date for same seq in tbl_one.seq.
    eg: -
    name (indian) which has three or more test_date and each test_date have more than one order_date
    indian (name) 01/01/2009(test_date) has ---- 01/10/2009, 01/20/2009 and 01/21/2009) order_dates
    india(name) 02/02/2009 (test_date) has ----- 02/10/2009, 02/20/2009 and 02/30/2009 (order_dates)
    india(name) 03/03/2009 test_date has ----- 03/10/2009, 03/20/2009 , 03/25/2009 (order_dates).
    japan has the same situation and so on
    what i wanted from the query is
    max(test_date)= 03/03/2009 > max(order_date)=03/25/2009
    ans: -
    name
    india(name) 03/03/2009 (test_date) 03/25/2009(order_date)
    etc. etc . etc.
    thanks!!
    Edited by: pl/sql baby on Mar 24, 2009 10:45 AM
    Edited by: pl/sql baby on Mar 24, 2009 10:47 AM
    Edited by: pl/sql baby on Mar 24, 2009 10:51 AM
    Edited by: pl/sql baby on Mar 24, 2009 10:57 AM

    Please use tags either side of code / data (to preserve the formatting and spacing).
    I don't understand your requirement... 03/03/2009 is not greater than 03/25/2009 ?
    Could you please be clearer in your input/output samples and explain more about how to generate the output?                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               

  • Snmp query for TenGigE data counters C4510R+E?

    Dear community. With the risk of sounding like an idiot I turn to you:
    I'm having slight challenges reading the data counters for a ten gigabit Ethernet interfaces on our C4510R+E w/sup8 with this IOS:
    bootflash:/cat4500es8-universalk9.SPA.03.03.00.XO.151-1.XO.bin
    running snmpwalk on ifindex reveals all indices properly, i.e:
    IF-MIB::ifName.1 = STRING: Fa1
    IF-MIB::ifName.2 = STRING: Gi1/1
    IF-MIB::ifName.3 = STRING: Gi1/2
    IF-MIB::ifName.4 = STRING: Gi1/3
    …etc…
    IF-MIB::ifName.259 = STRING: VLAN-601
    IF-MIB::ifName.260 = STRING: VLAN-876
    IF-MIB::ifName.261 = STRING: Te5/1--Uncontrolled
    IF-MIB::ifName.262 = STRING: Te5/1--Controlled
    ...etc...
    but when trying to see the octet counts from for example ifindex 261 or 262 I get no results at all:
    ...etc...
    IF-MIB::ifHCInOctets.230 = Counter64: 0
    IF-MIB::ifHCInOctets.231 = Counter64: 0
    NOTE: no ifIndex 261 or 262
    IF-MIB::ifHCInOctets.293 = Counter64: 0
    IF-MIB::ifHCInOctets.294 = Counter64: 0
    ...etc...
    All other physical interfaces show their values just fine - just not the TenGigE's.
    so, dear community: is this a problem, feature or something that can be configured to work differently? or is it just me :-) googling something like "snmp tengigabitethernet counters" brings up mostly problems with the max data rate but in my case the snmp values do not seem to exist at all.
    Thanks in advance,
    JukkaK

    It may be helpful to see the entire output/snmpwalk for ifTable and ifXTable for this device to see if all the data is missing for these indexes/TE interfaces.
    Many older IOS has some issues where the details for a perticular linecards and its associated interfaces were missing from Switch.
    Many times it worked after reseat of Linecard or Reboot of the entire device. As these are not the easy and not the first choice for many, lets check the outputs first.
    Also from the switch, please share output for device for show snmp mib ifmib ifindex command.
    -Thanks
    Vinod
    **Encourage Contributors. RATE Them.**

  • Query for getting data for every quarter for financial year

    Hi,
    My problem is I need to get the data for every quarter for financial year and also I need data for every week for financial year.
    For example for financial year 2012-13, Apr2012 to Jun2012 would be Q1, Jul2012 to Sep2012 would be Q2 and so on. Total 8quarters should come upto Apr2013.
    In the same way  1st apr 2012 to 7th apr 2012 would be week1, 8th apr to 15th apr would be week2 and son on. How to write a query for this scenario in oracle. Can anybody help me on this. very urgent..
    Thanks in advance.

    lakmesri wrote:
    Hi,
    My problem is I need to get the data for every quarter for financial year and also I need data for every week for financial year.
    For example for financial year 2012-13, Apr2012 to Jun2012 would be Q1, Jul2012 to Sep2012 would be Q2 and so on. Total 8quarters should come upto Apr2013.
    In the same way  1st apr 2012 to 7th apr 2012 would be week1, 8th apr to 15th apr would be week2 and son on. How to write a query for this scenario in oracle. Can anybody help me on this. very urgent..
    Thanks in advance.
    How can you get 8 quarters within a year ? I'b be concerned here.
    lakmesri wrote:
    Hi,
    In the same way  1st apr 2012 to 7th apr 2012 would be week1, 8th apr to 15th apr would be week2 and son on. How to write a query for this scenario in oracle. Can anybody help me on this. very urgent..
    Thanks in advance.
    First, that question is really not clearly asked. Second how could it be urgent ? You even did not tell us your Oracle version, did not show any tables descr, output sample nor any effort on your side to work on.
    Nicolas.

  • Need help with query for converting columns to rows

    Hello,
    I know this is a very common question asked in the forum. I have searched regading this, i did find some threads, but i was not able to achieve what i require from the answers posted. So anybody please help me.
    I have a table which is having multiple columns as follows:
    Insert into table_1 (X,Y,Z,A,B,C,D,E,F,G,H,I) values (0,0,2,0,0,1,3,0,0,0,0,0);I want to convert the result into a two column, multiple rows i.e., I want the result as follows:
    Col1 Col2
    X      0
    Y     0
    Z      2
    A     0
    B     0
    C     1
    D     3
    E     0
    F     0
    G     0
    H     0
    I      0Please anybody help me in writing the query for this..

    Is this what you are expecting:
    SQL> WITH T AS
      2  (
      3  SELECT 0 X, 0 Y, 2 Z, 0 A, 0 B, 1 C, 3 D, 0 E, 0 F, 0 G, 0 H, 0 I FROM DUAL
      4  )
      5  SELECT  'X' col1, X col2 FROM T
      6  UNION ALL
      7  SELECT  'Y' col1, Y col2 FROM T
      8  UNION ALL
      9  SELECT  'Z' col1, Z col2 FROM T
    10  UNION ALL
    11  SELECT  'A' col1, A col2 FROM T
    12  UNION ALL
    13  SELECT  'B' col1, B col2 FROM T
    14  UNION ALL
    15  SELECT  'C' col1, C col2 FROM T
    16  UNION ALL
    17  SELECT  'D' col1, D col2 FROM T
    18  UNION ALL
    19  SELECT  'E' col1, E col2 FROM T
    20  UNION ALL
    21  SELECT  'F' col1, F col2 FROM T
    22  UNION ALL
    23  SELECT  'G' col1, G col2 FROM T
    24  UNION ALL
    25  SELECT  'H' col1, H col2 FROM T
    26  UNION ALL
    27  SELECT  'I' col1, I col2 FROM T
    28  /
    C       COL2                                                                   
    X          0                                                                   
    Y          0                                                                   
    Z          2                                                                   
    A          0                                                                   
    B          0                                                                   
    C          1                                                                   
    D          3                                                                   
    E          0                                                                   
    F          0                                                                   
    G          0                                                                   
    H          0                                                                   
    C       COL2                                                                   
    I          0                                                                   
    12 rows selected.

  • Help on query replacing the date

    Hi Pals,
    i want to replace the current date in a column to some value say C or D or any numeric value , likewise the NVL function which replaces the null value can i replace value selected to my assigned value
    eg
    select * from employee where employeedate= current dat will display the dates as 2008-10-10 to C or D

    Hi,
    Welcome to the forum!
    Sorry, it's unclear what you want.
    If you have two NUMBER columns (c and d) and you want to diplay either one or the other, based on a DATE column (dt), then you can use a CASE expression.
    For example, if dt is earleir than this year, then you want to display c, and if dt is in the current year or later, then you want to display d:
    SELECT  ...
    ,       CASE
                WHEN  dt < TRUNC (SYSDATE, 'YY')
                THEN  c
                ELSE  d
            END   AS c_or_d
    ...You can use a CASE expression wherever expressions are allowed. For example, either argument to NVL can be a CASE expression.
    Whenever you have a question like this, it helps to post some sample data (CREATE TABLE and INSERT statements) and the resuts you want from that data.

  • Query for due date

    Hi All,
    How to write a query for an alert to be generated 5 days before the document due date?
    thanks
    SV Reddy

    Hi Everybody for your valuable suggestions.
    When we execute this query in normal mode by going to user query menu, it returns some records that can be displayed on to the screen in a separate window.  When you attach this query to an Alert, how the Alert will trigger ?
    Is it when the query returns more than 1 record then the name of the Alert will display in the inbox of the user ? 
    OR
    Is it the result of the query displayed in the window?
    What will happen when this query returns 0 records ?  means is that true the alert wont be triggerred ?
    What is the base criteria that an alert take in to consideration when to send a popup to the specified users?
    Please reply
    Thanks

  • Query for spatial data with a GeometryCollection fails

    There are exact 538 CurvePolygons (only exterior rings at this
    sample). All of them are valid geometries and equal in dimension
    and so on. Now I connect them to a GeometryCollection and query
    for other relating spatial data in some tables. It seems that
    the use of around (not exact!) 200 CurvePolygon in one
    GeometryCollection works fine but the adding of more
    CurvePolygon result in an error with the Spatial Index (I could
    add the ORA- error numbers if I have some data in my test tables
    again next days).
    Is there anybody else having trouble with these mysterious
    problem? Maybe there is a border by the number of points in
    GeometryCollection?
    (More details, programming code could be delivered)
    (working with Java 1.3.1, oracle.sdoapi.*, Oracle 8.1.7.)

    Hi Lutz,
    Could you provide more info or samples of what is going wrong?
    Also, could you try making sure the geometry you are passing in
    as the query window is valid (i.e. instead of passing it in as a
    query window, pass it into sdo_geom.validate_geometry).
    Thanks,
    Dan

  • Master data time dependant attribute in query for several dates

    Hello all,
    I need to create a query to display prices for a material in different periods. 
    The user will enter a period interval.  For each period, they want to know the material price the last day of that period.
    Material price is a time-dependat attribute of material, and I created one formula variable to display it. The problem is the using the key-date of the query only works for a date, but not for severals.
    Is there any other way to do it?
    If not, the only solution I find is to have in the infoprovider the prices that I need, but I don't think this is a good practice.
    Any suggestions?
    Thanks!

    I have just seen something: in fact the created lines are:
    Key1   Compound1   fromdate    todate    attr1      attr2
    0001      L      01.01.1000      01.01.2006          <empty
    so as you can see, the right interval is created but the attributes are not up to date.
    Cheers.
    Cyril.

  • Query for FormSubmit data by ID via the SOAP API

    When I submit a form entry via the SOAP API request 'Create' it get an ID as well as the Form Type data in return:
    <CreateResponse xmlns="https://secure.eloqua.com/API/1.2">
      <CreateResult xmlns:i="http://www.w3.org/2001/XMLSchema-instance">
           <CreateResult>
                <EntityType>
                     <ID>21</ID>
                     <Name>aherghaewForm</Name>
                     <Type>Form</Type>
                </EntityType>
                <Errors/>
                <ID>3</ID>
           </CreateResult>
      </CreateResult>
    </CreateResponse>
    However, I can't seem to query for that ID. When using the request 'Query'
    <ns:Query>
      <ns:eloquaType>
           <ns:ID>21</ns:ID>
           <ns:Type>Form</ns:Type>
      </ns:eloquaType>
      <ns:searchQuery>ID='3'</ns:searchQuery>
      <ns:pageNumber>1</ns:pageNumber>
      <ns:pageSize>20</ns:pageSize>
    </ns:Query>
    I receive the following Error:
    The search query you provided is invalid: 'id' is invalid.
    As the field 'ID' is not part of the FieldValueCollection, this outcome is not unexpected, but unfortunate, as it would greatly simplify querying for data that was just submitted. Querying for a field that is part of the FieldValueCollection delivers correct results.
    Is there a way to do just that, or do i have to follow another approach to retrieve FormSubmit data?
    Thanks,
    Felix

    OK. I see column X logic now:
    SQL> select  id,
      2          name,
      3          case when instr(sys_connect_by_path(id,',') || ',',',4,') > 0 then 'X' else 'Y' end x
      4    from  worker
      5    start with id in (
      6                      select  id
      7                        from  worker
      8                        where boss_id is null
      9                        start with id = 4
    10                        connect by prior boss_id = id
    11                      )
    12    connect by prior id = boss_id
    13  /
            ID NAME                             X
             1 Mennan                           Y
             2 Ahmet                            Y
             3 Akin                             Y
             4 Ayse                             X
             5 Aylin                            X
             6 Selim                            Y
    6 rows selected.
    SQL>SY.

Maybe you are looking for

  • IChat AV problems with Comcast as ISP

    I've been a user of iChat AV for several years, and in the past 6-8 months it's stopped working as well as it used to. I routinely used it to connect from California to Florida and Indiana, and now I get about one minute or less of decent audio and v

  • How to create the Table of Contents in Preview for a pdf file?

    Does anyone know how to use the Preview to create a new table of contents or add a new link to the existing table of contents? Thanks

  • How to divide two int numbers and get a fraction ?

    I am dividing two int numbers and the result should be a fraction but I am always getting a zero set @result= @num1/@num2   when num1=50 and num2=100

  • Cfinvokeargument and trying to pass dates to a cfc/query

    Hi I have a situation where passing a date along to a cfc method (which runs a basic SQL select query) fails. if i hardcode the datevalue into the cfc file or hardcode the select statement into the page with the , it works. so something in the passin

  • Need help with videos on ipod

    Hello again everybody... If i have a music video that itunes has put as a movie, how do I move it to music videos and take it out of movies. Thanks in advance