If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > Database Server Software > DB2 > Comparison of rows.

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 12-14-11, 06:15
thawfii88 thawfii88 is offline
Registered User
 
Join Date: Nov 2011
Posts: 13
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
Reply With Quote
  #2 (permalink)  
Old 12-14-11, 06:30
sathyaram_s sathyaram_s is offline
Super Moderator
 
Join Date: Aug 2001
Location: UK
Posts: 4,534
an example will help.
__________________
Visit the new-look IDUG Website , register to gain access to the excellent content.
Reply With Quote
  #3 (permalink)  
Old 12-14-11, 06:58
thawfii88 thawfii88 is offline
Registered User
 
Join Date: Nov 2011
Posts: 13
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 07:03.
Reply With Quote
  #4 (permalink)  
Old 12-14-11, 07:56
tonkuma tonkuma is offline
Registered User
 
Join Date: Feb 2008
Location: Japan
Posts: 2,193
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.
Reply With Quote
  #5 (permalink)  
Old 12-14-11, 18:33
iam_hari iam_hari is offline
Registered User
 
Join Date: Jul 2011
Posts: 8
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.
Reply With Quote
  #6 (permalink)  
Old 12-15-11, 02:30
przytula_guy przytula_guy is offline
Registered User
 
Join Date: Apr 2006
Location: Belgium
Posts: 1,159
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
DB2 UDB LUW Certified V7-V8-V9-V9.7 DB Admin - Dprop..
Information Server Datastage Certified
http://www.infocura.be
Reply With Quote
  #7 (permalink)  
Old 12-15-11, 03:40
iam_hari iam_hari is offline
Registered User
 
Join Date: Jul 2011
Posts: 8
Sorry by mistake i did that.

Thanks for giving the information.
Reply With Quote
  #8 (permalink)  
Old 12-16-11, 08:27
thawfii88 thawfii88 is offline
Registered User
 
Join Date: Nov 2011
Posts: 13
Thanks a lot
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On