Results 1 to 8 of 8
  1. #1
    Join Date
    Nov 2011
    Location
    Chennai
    Posts
    27

    Unanswered: Comparison of rows.

    Hi ,

    Can anyone help me out in getiing the comparison of the rows updated in same table using the updated time.

    Thanks
    thawfii88

  2. #2
    Join Date
    Aug 2001
    Location
    UK
    Posts
    4,650
    an example will help.
    Visit the new-look IDUG Website , register to gain access to the excellent content.

  3. #3
    Join Date
    Nov 2011
    Location
    Chennai
    Posts
    27
    I want to get the diidference between yesterday and today from this o\p

    NAME UPDATED_TIME
    ------------------- --------------------------

    appgroup_mem_sz 2011-12-01-00.00.00.000000
    auto_del_rec_obj 2011-12-01-00.00.00.000000

    appgroup_mem_sz 2011-12-02-06.32.32.375636
    auto_del_rec_obj 2011-12-02-06.32.32.375636
    auto_prof_upd 2011-12-02-06.32.32.375636


    The query should give the o/p as

    auto_prof_upd 2011-12-02-06.32.32.375636
    Last edited by thawfii88; 12-14-11 at 08:03.

  4. #4
    Join Date
    Feb 2008
    Location
    Japan
    Posts
    3,483
    I think that your description of requirement is incomplete
    and your example is too little.
    For example:
    a) how to know today?
    If used CURRENT_DATE special register, your data doesn't include today's data.
    b) If a data(name) exists yesterday, but does not exists today,
    how to do?
    Simply ignore it?

    Anyhow, here is a sample query to get the same result from your example data.
    Example 1:
    Code:
    ------------------------------ Commands Entered ------------------------------
    WITH
     sample_data(name , updated_time) AS (
    VALUES
      ( 'appgroup_mem_sz'  , '2011-12-01-00.00.00.000000' )
    , ( 'auto_del_rec_obj' , '2011-12-01-00.00.00.000000' )
    , ( 'appgroup_mem_sz'  , '2011-12-02-06.32.32.375636' )
    , ( 'auto_del_rec_obj' , '2011-12-02-06.32.32.375636' )
    , ( 'auto_prof_upd'    , '2011-12-02-06.32.32.375636' )
    )
    SELECT t.*
     FROM  sample_data t
     WHERE DATE(updated_time) = /*today*/ DATE('2011-12-02')
       AND NOT EXISTS
           (SELECT 0
             FROM  sample_data ne
             WHERE ne.name = t.name
               AND DATE(ne.updated_time) = DATE(t.updated_time) - 1 DAY
                                           /* yesterday = today - 1 day */
           )
    ;
    ------------------------------------------------------------------------------
    
    NAME             UPDATED_TIME              
    ---------------- --------------------------
    auto_prof_upd    2011-12-02-06.32.32.375636
    
      1 record(s) selected.

  5. #5
    Join Date
    Jul 2011
    Posts
    17

    Backup details

    Hi All,

    Please can anybody help me? all the below question are releated to db2? am planning to write script?

    1. How can we come to know Average full backup time?
    2. How to check Last 7 days full backup?
    3. How to check Full backup size growth?
    4. How to check Full backup time?
    5. How to check Latest successful backup?

    Thanks for help in advance.

  6. #6
    Join Date
    Apr 2006
    Location
    Belgium
    Posts
    2,514
    Provided Answers: 11
    do not mix your question with questions of other users as this creates a chaos
    anyhow : all info about backup is in the history file or can be queried by use of predefined db2 views.. have a look at doc to see the details of this..
    Best Regards, Guy Przytula
    Database Software Consultant
    Good DBAs are not formed in a week or a month. They are created little by little, day by day. Protracted and patient effort is needed to develop good DBAs.
    Spoon feeding : To treat (another) in a way that discourages independent thought or action, as by overindulgence.
    DB2 UDB LUW Certified V7-V8-V9-V9.7-V10.1-V10.5 DB Admin - Advanced DBA -Dprop..
    Information Server Datastage Certified
    http://www.infocura.be

  7. #7
    Join Date
    Jul 2011
    Posts
    17
    Sorry by mistake i did that.

    Thanks for giving the information.

  8. #8
    Join Date
    Nov 2011
    Location
    Chennai
    Posts
    27
    Thanks a lot

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •