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

Home -> Community -> Mailing Lists -> Oracle-L -> RE: Help Need

RE: Help Need

From: Cale, Rick T (Richard) <RICHARD.T.CALE_at_saic.com>
Date: Thu, 02 Aug 2001 22:52:44 -0700
Message-ID: <F001.0035D3D5.20010802044030@fatcity.com>

Are
all the columns in user repeated? I doubt it because you would just remove duplicate records.  I am assuming userid is key field. You
could try
<FONT face=Arial color=#0000ff

size=2> 
CREATE
TABLE usercheck AS SELECT * FROM user;
ALTER
TABLE usercheck ADD(repeated NUMBER);
UPDATE
usercheck a
SET
repeated = (SELECT COUNT(*) - 1
<FONT face=Arial color=#0000ff

size=2>                         

FROM user b
<FONT face=Arial color=#0000ff
size=2>                         

WHERE b.userid=a.userid
<FONT face=Arial color=#0000ff
size=2>                         

GROUP BY userid
<FONT face=Arial color=#0000ff
size=2>                         

HAVING COUNT(*) > 1);
<FONT face=Arial color=#0000ff

size=2> 
<FONT face=Arial color=#0000ff

size=2>Rick

From: Deewaker G.V.
[mailto:Deewaker_at_baazee.com]Sent: Thursday, August 02, 2001 7:40 AMTo: Multiple recipients of list ORACLE-LSubject: Help Need

  Hi DBA Gurus,
  I have a table called user..   

  It has userid, firstname, lastname,
  city, address, telephone, email
  There are some userid which have
  been reentered .. I would like to insert a column called repeats and take the   number of times the userid is repeated   How to I go about it
  Create table usercheck as (userid,
  firstname, repeated,lastname, city, address, telephone, email)   As <FONT
  face="Arial Narrow" color=#0000ff>Select userid, firstname, count(*) userid as   repeated,,lastname, city, address, telephone, email) <FONT   face="Arial Narrow" color=#0000ff>From user;   Something like this..
  For example the userid of Deewaker
  is 123123 and he as been inserted 5 times in the table USER the Repeated   should give a count of 4.
  Please help me.
  with warm regards,
  Deewaker G. V.
  Baazee.com India Pvt. Ltd.
  (<FONT face="Book Antiqua"
  color=#0000ff>: 4611323 Extn: 216 <FONT face="Book Antiqua"   color=#0000ff>Fax : 4611324
  <<Deewaker G.V..vcf>>    Received on Fri Aug 03 2001 - 00:52:44 CDT

Original text of this message

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