to remove duplicates

General
Enthusiast

to remove duplicates

Dear Friends,

I have a table with username, dbname, objecttablename, object type (Table or view). For some data, there are objecttablename that  is same for both table and view. i.e the view and table name are same but different databases. If that is the case, I need to remove the duplicate (i.e objecttype view has to be removed) and have only the row of objecttablename and objecttype as table as output. Could anyone please help on this approach?

2 REPLIES
Enthusiast

Re: to remove duplicates

Can you post some sample data

Enthusiast

Re: to remove duplicates

Workaround:

Create a new table with same structure:

INSERT INTO NEWTABLE

SELECT * FROM OLDTABLE

QUALIFY ROW_NUMBER() OVER(PARTITION BY OBJECTTABLENAME ORDER BY OBJECTTYPE) = 1;

Br,

Khurram

Khurram