Home » SQL & PL/SQL » SQL & PL/SQL » Help On Query to fetch the master records? (Oracle 10 g)
Help On Query to fetch the master records? [message #346333] Mon, 08 September 2008 04:31 Go to next message
rangan.s
Messages: 75
Registered: February 2008
Location: chennai
Member
create table test_ora
(
no number,
name varchar2(15),
dept varchar2(15),
medal varchar2(15)
);
insert into test_ora values(1,'alg','cse','gold');
insert into test_ora values(2,'alg','cse','gold');
insert into test_ora values(3,'alg','cse','gold');
insert into test_ora values(4,'alg','cse','gold');
insert into test_ora values(5,'alg','cse','silver');
insert into test_ora values(6,'alg','cse','silver');
insert into test_ora values(7,'alg','cse','silver');


SQL> select * from test_ora;

        NO NAME            DEPT            MEDAL
---------- --------------- --------------- ---------------
         1 alg             cse             gold
         2 alg             cse             gold
         3 alg             cse             gold
         4 alg             cse             gold
         5 alg             cse             silver
         6 alg             cse             silver
         7 alg             cse             silver

7 rows selected

I want to select only master record like follows  and need to delete the other records except the other records show below

SQL> select * from test_ora;

        NO NAME            DEPT            MEDAL
---------- --------------- --------------- ---------------
         1 alg             cse             gold
         5 alg             cse             silver
       


can you help me through query ?
Re: Help On Query to fetch the master records? [message #346334 is a reply to message #346333] Mon, 08 September 2008 04:34 Go to previous messageGo to next message
Olivia
Messages: 519
Registered: June 2008
Senior Member
Use Min, Group By...


Regards,
Oli
Re: Help On Query to fetch the master records? [message #346356 is a reply to message #346333] Mon, 08 September 2008 05:48 Go to previous message
Michel Cadot
Messages: 68733
Registered: March 2007
Location: Saint-Maur, France, https...
Senior Member
Account Moderator
Find and delete duplicates are among the most posted questions.
Please search BEFORE posting.

Regards
Michel
Previous Topic: Confusion Regarding TKPROF
Next Topic: index
Goto Forum:
  


Current Time: Sun Feb 09 22:38:16 CST 2025