SQL Language (MOSC)

MOSC Banner

Removing Duplicates in SQL

edited Jun 30, 2011 8:28PM in SQL Language (MOSC) 11 commentsAnswered
Hi all,

I have a requirement to remove duplicates from a set of data as per the example below, can anyone advise how I can do this using just SQL:

Raw Data
Col1 Col2 Col3         Col4
1     100 color:yellow    Y
2      64 rtdiagstripe    Y
3      64                 Y
4      64                 Y
5      64 rtstripe        N
6      64 rtdiagstripe    N
7      64                 Y
8      64                 Y
9      64                 Y


Required Output
Col1 Col2 Col3         Col4    Count
1     100 color:yellow    Y        1
2      64 rtdiagstripe    Y        1
3      64                 Y        2
5      64 rtstripe        N        1
6      64 rtdiagstripe    N        1
7      64                 Y        3


Thanks,
Greg

Howdy, Stranger!

Log In

To view full details, sign in to My Oracle Support Community.

Register

Don't have a My Oracle Support Community account? Click here to get started.

Category Leaderboard

Top contributors this month

New to My Oracle Support Community? Visit our Welcome Center

MOSC Help Center