Click here to Skip to main content
15,891,184 members
Home / Discussions / Database
   

Database

 
Questionformula column Pin
ptvce10-Nov-08 22:48
ptvce10-Nov-08 22:48 
AnswerRe: formula column Pin
Mycroft Holmes11-Nov-08 1:22
professionalMycroft Holmes11-Nov-08 1:22 
AnswerRe: formula column Pin
Wendelius11-Nov-08 4:18
mentorWendelius11-Nov-08 4:18 
QuestionHOW TO REMOVE THE DUPLICATE ROWS IN THE TABLE Pin
harsha_mec34510-Nov-08 20:54
harsha_mec34510-Nov-08 20:54 
AnswerRe: HOW TO REMOVE THE DUPLICATE ROWS IN THE TABLE Pin
Ashfield10-Nov-08 21:10
Ashfield10-Nov-08 21:10 
GeneralRe: HOW TO REMOVE THE DUPLICATE ROWS IN THE TABLE Pin
harsha_mec34510-Nov-08 21:26
harsha_mec34510-Nov-08 21:26 
GeneralRe: HOW TO REMOVE THE DUPLICATE ROWS IN THE TABLE Pin
Ashfield10-Nov-08 21:55
Ashfield10-Nov-08 21:55 
AnswerRe: HOW TO REMOVE THE DUPLICATE ROWS IN THE TABLE [modified] Pin
Wendelius11-Nov-08 4:34
mentorWendelius11-Nov-08 4:34 
I'm guessing that you're using Oracle (based on the table name).

If that's true and all the rows are identical, you can use rowid in delete statement. For example, if you want to leave the 'first' row, the statement could be:
DELETE FROM Emp
WHERE ROWID > (SELECT MIN(ROWID) 
               FROM   Emp);


Correction: As Ashfield pointed out, I misunderstood the question. The statement above will delete all the records except one (for some reason I understood that all are duplicates).

If the table has both duplicate and non-duplicate rows, you can use correlated condition. The condition would be something like the following (all the fields from Emp must be included in correlation):
DELETE FROM Emp a
WHERE a.ROWID > (SELECT MIN(b.ROWID) 
                 FROM   Emp b
                 WHERE  a.Field1 = b.Field1
                 AND    a.Field2 = b.Field2...);


Sorry for the confusion,

Mika

The need to optimize rises from a bad design.

My articles[^]

modified on Tuesday, November 11, 2008 11:42 AM

GeneralRe: HOW TO REMOVE THE DUPLICATE ROWS IN THE TABLE Pin
Ashfield11-Nov-08 5:22
Ashfield11-Nov-08 5:22 
GeneralRe: HOW TO REMOVE THE DUPLICATE ROWS IN THE TABLE Pin
Jon_Boy11-Nov-08 5:29
Jon_Boy11-Nov-08 5:29 
GeneralRe: HOW TO REMOVE THE DUPLICATE ROWS IN THE TABLE Pin
Wendelius11-Nov-08 5:42
mentorWendelius11-Nov-08 5:42 
GeneralRe: HOW TO REMOVE THE DUPLICATE ROWS IN THE TABLE Pin
Ashfield11-Nov-08 9:06
Ashfield11-Nov-08 9:06 
JokeRe: HOW TO REMOVE THE DUPLICATE ROWS IN THE TABLE Pin
Wendelius11-Nov-08 10:06
mentorWendelius11-Nov-08 10:06 
QuestionDesign Help for Distributed Database System Pin
Saiyed Alam10-Nov-08 19:53
Saiyed Alam10-Nov-08 19:53 
QuestionData import Pin
postonoh10-Nov-08 9:36
postonoh10-Nov-08 9:36 
AnswerRe: Data import Pin
Mycroft Holmes11-Nov-08 1:20
professionalMycroft Holmes11-Nov-08 1:20 
GeneralRe: Data import Pin
postonoh19-Nov-08 10:27
postonoh19-Nov-08 10:27 
QuestionAppend the records to existing sp table Pin
soniasan10-Nov-08 6:49
soniasan10-Nov-08 6:49 
AnswerRe: Append the records to existing sp table Pin
Wendelius10-Nov-08 7:14
mentorWendelius10-Nov-08 7:14 
Question.Net OdbcConnection for Oracle Lite 40 ODBC Driver Pin
TheIdleProgrammer10-Nov-08 0:17
TheIdleProgrammer10-Nov-08 0:17 
AnswerRe: .Net OdbcConnection for Oracle Lite 40 ODBC Driver Pin
Wendelius10-Nov-08 5:25
mentorWendelius10-Nov-08 5:25 
GeneralRe: .Net OdbcConnection for Oracle Lite 40 ODBC Driver Pin
TheIdleProgrammer10-Nov-08 21:14
TheIdleProgrammer10-Nov-08 21:14 
GeneralRe: .Net OdbcConnection for Oracle Lite 40 ODBC Driver Pin
Wendelius11-Nov-08 8:15
mentorWendelius11-Nov-08 8:15 
GeneralRe: .Net OdbcConnection for Oracle Lite 40 ODBC Driver Pin
TheIdleProgrammer11-Nov-08 21:25
TheIdleProgrammer11-Nov-08 21:25 
GeneralRe: .Net OdbcConnection for Oracle Lite 40 ODBC Driver Pin
Wendelius13-Nov-08 10:36
mentorWendelius13-Nov-08 10:36 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.