duplicate column [message #605003] |
Mon, 06 January 2014 18:27 |
|
nataliafoster26
Messages: 64 Registered: October 2013
|
Member |
|
|
is there a way i can run a query that will show me in a table to find if in a specific collumn there is a duplicate?
i have this table
CREATE TABLE PREMIER.P_LEAD
(
LEAD_ID NUMBER(12) NOT NULL,
SMR_GLOBAL_NAME VARCHAR2(60 BYTE),
SMR_TIME_STAMP DATE,
LEAD_TYPE VARCHAR2(3 BYTE) DEFAULT 'RG' NOT NULL,
RECEIVE_MAIL_IND VARCHAR2(1 BYTE) DEFAULT 'Y' NOT NULL,
USERNAME VARCHAR2(60 BYTE),
)
which has more that 10 million records, i want to find two records that have the USERNAME the same/duplicate?
not a specific record just want to find one that is the same
is this possible?
[EDITED by LF: fixed topic title typo; was "collumn". Applied [code] tags]
[Updated on: Tue, 07 January 2014 09:17] by Moderator Report message to a moderator
|
|
|
|
|
|
|
|
Re: duplicate collumn [message #605009 is a reply to message #605007] |
Mon, 06 January 2014 18:49 |
cookiemonster
Messages: 13920 Registered: September 2008 Location: Rainy Manchester
|
Senior Member |
|
|
BS has got has where and having clauses confused, should be:
SELECT USERNAME, COUNT(*) FROM P_LEAD GROUP BY USERNAME HAVING COUNT(*) > 1;
|
|
|
|
|
|