Portal | Manuals | References | Downloads | Info | Programs | JCLs | Mainframe wiki | Quick Ref
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Profile Log in to check your private messages Log in
 
If we have two same rows and want to Delete only one row

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

New User


Joined: 26 Dec 2005
Posts: 18
Location: India

PostPosted: Wed Nov 18, 2009 7:47 pm    Post subject: If we have two same rows and want to Delete only one row
Reply with quote

If we have two same rows and want to Delete only one row from DB2 table. is it possible thru SQL ? If os please let me know.

Thanks,
G C Chowdary
Back to top
View user's profile Send private message

Bharath Bhat

Active User


Joined: 20 Mar 2008
Posts: 283
Location: chennai

PostPosted: Wed Nov 18, 2009 8:23 pm    Post subject:
Reply with quote

People started thinking primary keys are not useful anymore? icon_eek.gif

The delete query will delete all the rows matching the where clause.
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 Nov 18, 2009 11:09 pm    Post subject:
Reply with quote

Hello,

One way to do what you want is with a cursor. . .
Back to top
View user's profile Send private message
sachin_star3
Warnings : 1

New User


Joined: 30 Sep 2006
Posts: 78
Location: pune

PostPosted: Thu Nov 19, 2009 12:24 am    Post subject: Reply to: If we have two same rows and want to Delete only o
Reply with quote

yes you can use the cursor and can delete the selected row.
Back to top
View user's profile Send private message
gcchowdary
Warnings : 1

New User


Joined: 26 Dec 2005
Posts: 18
Location: India

PostPosted: Thu Nov 19, 2009 11:19 am    Post subject: Reply to: If we have two same rows and want to Delete only o
Reply with quote

Thank You Dick & Sachin!!
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 Conditional highlighting of rows in I... packerm CLIST & REXX 2 Thu Sep 21, 2017 6:50 pm
No new posts column with count of rows within dist... ronald wouterson DB2 4 Sun Sep 17, 2017 9:48 pm
No new posts Convert rows and column into JSON for... Dinesh Manivannan DB2 2 Sun Sep 03, 2017 6:50 pm
No new posts Skip file from delete pema_yozer All Other Mainframe Topics 3 Tue Aug 29, 2017 3:19 pm
No new posts Delete IMS remote transaction when MO... Sam Singh IMS DB/DC 0 Wed Aug 23, 2017 9:12 pm

Facebook
Back to Top
 
Job Vacancies | Forum Rules | Bookmarks | Subscriptions | FAQ | Polls | Contact Us