Link to home
Start Free TrialLog in
Avatar of saloj
salojFlag for Canada

asked on

find duplicate values

i have following table structure and i would like to display all duplicate it has
-------------------------------------
id account nickname password
-------------------------------------
what could be the query

Thank you
Avatar of Máté Farkas
Máté Farkas
Flag of Hungary image

If the id field also can be duplicated
SELECT id, account, nickname, password, COUNT(*) [Count] FROM YourTable
GROUP BY id, account, nickname, password
HAVING COUNT(*) > 1

Open in new window

Avatar of saloj

ASKER

sorry, it has more columns, in that case how do i display all duplicates from column
Everyy column which you think it can contain duplicate value must be included after the SELECT and after the GROUP BY column list. So you can continue the column list after the password column.
Avatar of saloj

ASKER

but it has date column which is not duplicate but would like to display on result
how to do that
you can find duplicates value by this query

select count(Coloum name),coloum name from tablename
group by   ColoumName having count(Coloum name)>1  
ASKER CERTIFIED SOLUTION
Avatar of Máté Farkas
Máté Farkas
Flag of Hungary image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial