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
Answers were Sorted based on User's Feedback
Answer / mithlesh
delete from table_name
where address = '456' and '678'.
| Is This Answer Correct ? | 10 Yes | 4 No |
Answer / prashant shettar
delete from (select rownumber() over() as rowid from tab1 )
where rowid = ( (select count(*) from tab1) - 1)
| Is This Answer Correct ? | 2 Yes | 1 No |
Answer / suv
We can use concept of cursor to delete particular row. The
row where the cursor is pointing will get deleted.
Please correct is wrong..
| Is This Answer Correct ? | 0 Yes | 1 No |
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 |
How do you define a correlated name?
what is Static and dynamic linking
What is meant by a unit of recovery?
What happens to a tablespace when its recovery infromation has been removed and a full recovery is no longer possible?
how 2 resolve the -311 sqlcode
How to access db2 tables in mainframe?
What are the benefits of using the db2 database?
How do you simulate the EXPLAIN of an embedded SQL statement in SPUFI/QMF? Give an example with a host variable in WHERE clause)
How do you concatenate the firstname and lastname from emp table to give a complete name?
How do I optimize a query in db2?
What does an outer join do?
What is db2?