| min(rowid) [message #254278] |
Thu, 26 July 2007 06:26  |
lijojoseph
Messages: 9 Registered: July 2007 Location: Mumbai
|
Junior Member |
|
|
What is a rowid. I read that for deleting duplicate records the following command can be used
delete from emp where rowid not in(select min(rowid) from
emp group by empno);
what is this min(rowid) will select is it returns a single value whic will be common for unique records or something else?
how it is identifying the row id of unique records.
|
|
|
|
|
|
|
|
|
|
| Re: min(rowid) [message #254295 is a reply to message #254292] |
Thu, 26 July 2007 06:42   |
lijojoseph
Messages: 9 Registered: July 2007 Location: Mumbai
|
Junior Member |
|
|
Thanks Michel,
That means if there are 2 duplicate rows, then it will delete the second one (one with high rowid)
|
|
|
|
|
|
| Re: min(rowid) [message #254302 is a reply to message #254295] |
Thu, 26 July 2007 06:48  |
Frank
Messages: 7901 Registered: March 2000
|
Senior Member |
|
|
It will delete either one. There is no 'second' or 'first', unless you provide an explicit order by.
Indeed, the one with the higher rowid will be deleted, but this is not necessarily the one that was inserted last.
|
|
|
|