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: Thomas, Kevin <Kevin.Thomas_at_calanais.com>
Date: Thu, 02 Aug 2001 22:52:49 -0700
Message-ID: <F001.0035D381.20010802042527@fatcity.com>

Hi,  

This statement will get you the userid and the number of times it is duplicated. Then it's just a case of inserting the value at the desired location. Although this does mean that you are either going to have a column with lots of null values or lots of repeated values...Doesn't really make a lot of sense either way.  

select userid,

         count(userid)-1
   from user
 group by user_id;  

Regards,
Kev.

-----Original Message-----
Sent: 02 August 2001 12:40
To: Multiple recipients of list ORACLE-L

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
Select userid, firstname, count(*) userid as repeated,,lastname, city, address, telephone, email)
>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.
*: 4611323 Extn: 216
Fax : 4611324

<<Deewaker G.V..vcf>>

-- 
Please see the official ORACLE-L FAQ: http://www.orafaq.com
-- 
Author: Thomas, Kevin
  INET: Kevin.Thomas_at_calanais.com

Fat City Network Services    -- (858) 538-5051  FAX: (858) 538-5051
San Diego, California        -- Public Internet access / Mailing Lists
--------------------------------------------------------------------
To REMOVE yourself from this mailing list, send an E-Mail message
to: ListGuru_at_fatcity.com (note EXACT spelling of 'ListGuru') and in
the message BODY, include a line containing: UNSUB ORACLE-L
(or the name of mailing list you want to be removed from).  You may
also send the HELP command for other information (like subscribing).
Received on Fri Aug 03 2001 - 00:52:49 CDT

Original text of this message

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