How can I make the following Column
------------
MakeDistinct
------------
CAT
CAT
CAT
DOG
DOG
PIN
PIN
PIN
PIN
As Shown Below
------------- -------
AfterDistinct Count
------------- -------
CAT 3
DOG 2
PIN 4
Use
COUNT()
function by groupingMakeDistinct
column usingGROUP BY
clause.Output:
See this SQLFiddle
Please try: