i have a table like this :
Name ADDRESS
Toto 123 ...
Toto 456
ToTo 678

I would like to delete 2 last row...please tell me how to
delete its

Answer Posted / vaneesh khurana

I think better to perform this in following 2 queries

1. Select count(WS-COUNT) from TABLE;

2. DELETE FROM TABLE WHERE ROWCOUNT(*) IS WS-COUNT OR
(WS-COUNT-1);

Basically here the first row will give you the record count
and 2nd will delete the last and the 2nd last row.

Is This Answer Correct ?    0 Yes 2 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

I understand Join always perform better than subqueries. Then what is the advantage/use of Subqueries/correlated subqueries etc.,in DB2 programming.Please explain.

1651


What is the difference between db2 and oracle?

677


What are packages in db2?

597


While unloading huge amount of data from table. Suddenly job failed some error. Imagine 1M data unloading, In that 90% data unloaded only 10% left, So if want to unload the rest 10% what needs to be done? Whether do i need to start from top or anything ?

1818


What is database alias db2?

606






What is role in db2?

620


What is the physical storage length of the data types date, time, and timestamp?

610


How do you stop a db2 database in linux?

568


How can you count the number of rows from a table tab?

637


What are the various isolation levels possible?

649


what are bind concepts in db2 cobol?

651


What is the difference between "db2ilist" and "db2 get instance" commands in DB2 Database Server?

711


Explain dclgen.

724


what is db2 restart?

1693


What is commit in db2?

596