Quantcast
Channel: IBM Mainframe Computers Forums
Viewing all articles
Browse latest Browse all 8500

DB2 :: RE: Need DB2 query to fetch previous row !

$
0
0
Author: Rohit Umarjikar
Posted: Tue Jun 06, 2017 7:59 pm (GMT 5.5)

Assuming you do insert a row (second time) with change_column as 'U' and your original row still has change_column <> 'U'. So hence forth all your updates to this unique record is performed on second row and first row is untouched. In that case you can try this.
Code:
select * from table1 A
where exists ( select 1 from table1 B
                     where A.key1 = B.key2
                        and B.change_column = 'U' )

_________________
Regards,
Rohit Umarjikar
"Knowledge is knowing that a tomato is a fruit, but Wisdom is knowing not to put it in a fruit salad."icon_razz.gif


Viewing all articles
Browse latest Browse all 8500

Trending Articles