question

sathyab18 avatar image
sathyab18 asked

Get duplication in Count field

This is query Select hackers.hacker_id,Hackers.name,count(challenges.Challege_id) from hackers inner join Challenges on hackers.hacker_id = Challenges.Hacker_id group by hackers.hacker_id,Hackers.name order by count(challenges.Challege_id) desc result cnt 6 5 4 4 1 in this query i need to get only repeated column. Thanks
select
1 comment
10 |1200

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

ThomasRushton avatar image ThomasRushton ♦♦ commented ·
so you only want to return the row where you have multiples? Check out the HAVING clause - https://docs.microsoft.com/en-us/sql/t-sql/queries/select-having-transact-sql?view=sql-server-2017 SELECT... FROM... WHERE... GROUP BY ... HAVING COUNT(*) > 1 ORDER BY ...
0 Likes 0 ·

0 Answers

·

Write an Answer

Hint: Notify or tag a user in this post by typing @username.

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.