Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Usenet -> c.d.o.misc -> Re: Deleting 1 and only 1 row from database

Re: Deleting 1 and only 1 row from database

From: Patrick Lanphier <planphier_at_psu.edu>
Date: 1998/11/01
Message-ID: <363CB28B.9C88C0E2@psu.edu>#1/1

I would do a group by on the entire table with max or min defined in the select and create a new table with the resulting records something like

CREATE TABLE new_table
SELECT max(column_a), ..., max(column_k) FROM table_x
GROUP BY column_a, ..., column_k

Using ROWNUM, and ROWID are also possible solutions

good luck.

Patrick Lanphier
Advanced Information Technologies
The Pennsylvania State University

NOSPAMstannon_at_yahoo.com wrote:
>
> Hi,
>
> I am a novice to Oracle and SQL and I would like to ask you experts
> for help.
>
> I have a database that has no primary key defined. The database allows
> dulplicate records. I want to remove some of the duplicate records so I
> thought of using "delete", but looking at the syntax, it seems the delete
> command will delete every matches, which is different from my goal -
> only the first matched record.
>
> Can anyone show me the syntax for deleting only 1 record (say, the
> first match)? Thanks!
>
> Stannon
> --
> (if you prefer E-mail, please remove "NOSPAM" from my addr)
>
> -----------== Posted via Deja News, The Discussion Network ==----------
> http://www.dejanews.com/ Search, Read, Discuss, or Start Your Own
  Received on Sun Nov 01 1998 - 00:00:00 CST

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US