Portal | Manuals | References | Downloads | Info | Programs | JCLs | Master the Mainframes
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Usergroups Profile Log in to check your private messages Log in
 

 

Can we update duplicate rows in a spufi by keeping any row

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> DB2
View previous topic :: :: View next topic  
Author Message
maheshvamsi

New User


Joined: 22 Mar 2008
Posts: 39
Location: bangalore

PostPosted: Wed Jul 06, 2011 10:51 pm    Post subject: Can we update duplicate rows in a spufi by keeping any row
Reply with quote

Hi,

by using spufi can we update a column duplicate rows by keeping one row unchanged.

Table:

Code:
col1 col2 col3
a      b     1
a      b     1
c      d     2
c      d     2


Based in col1 & col2 update col3

Output:

Code:
col1 col2 col3
a      b     1
a      b     0
c      d     2
c      d     0
Back to top
View user's profile Send private message

dick scherrer

Site Director


Joined: 23 Nov 2006
Posts: 19270
Location: Inside the Matrix

PostPosted: Wed Jul 06, 2011 11:02 pm    Post subject:
Reply with quote

Hello,

How/why is this a spufi question?

If you can define the "rules" you should be able to write the needed sql. . .

What has been posted is too limited a sample to establish "rules" (at least for me).
Back to top
View user's profile Send private message
GuyC

Senior Member


Joined: 11 Aug 2009
Posts: 1281
Location: Belgium

PostPosted: Thu Jul 07, 2011 3:21 pm    Post subject:
Reply with quote

db2 V9:
Code:
update table1 B set col3 = 0
where rid(B) not in (select min(rid(A)) from table1 A group by col1,col2,col3)
Back to top
View user's profile Send private message
maheshvamsi

New User


Joined: 22 Mar 2008
Posts: 39
Location: bangalore

PostPosted: Thu Jul 07, 2011 5:42 pm    Post subject:
Reply with quote

Hi Dick,

Its not a question about spufi, I want to know whether we can update the table using one querry instead of writing a program.

Thank you GuyC, for providing the solution.

icon_smile.gif
Back to top
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> DB2 All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts compare 2 rows within the same file ram_vizag SYNCSORT 7 Wed Jun 14, 2017 12:34 am
No new posts Fileaid Update Replace with null string descann Compuware & Other Tools 4 Mon May 15, 2017 3:00 pm
No new posts Using ICETOOL, how we can seperate th... bshkris SYNCSORT 5 Tue May 09, 2017 8:33 pm
This topic is locked: you cannot edit posts or make replies. Merge two files and update Trailer re... Yashashri JCL & VSAM 1 Thu May 04, 2017 12:54 pm
No new posts IMS DB-How to update a record (a sing... Nic Clouston IMS DB/DC 9 Thu Mar 09, 2017 4:38 pm


Facebook
Back to Top
 
Mainframe Wiki | Forum Rules | Bookmarks | Subscriptions | FAQ | Tutorials | Contact Us