We use cookies to ensure you have the best browsing experience on our website. Please read our cookie policy for more information about how we use cookies.
/* count total submissions of challenges of each user */WITHdataAS(SELECTc.hacker_idasid,h.nameasname,count(c.hacker_id)ascounterFROMHackershJOINChallengesconc.hacker_id=h.hacker_idGROUPBYc.hacker_id,h.name)/* select records from above */SELECTid,name,counterFROMdataWHEREcounter=(SELECTmax(counter)FROMdata)/*select user that has max count submission*/ORcounterin(SELECTcounterFROMdataGROUPBYcounterHAVINGcount(counter)=1)/*filter out the submission count which is unique*/ORDERBYcounterdesc,id
Challenges
You are viewing a single comment's thread. Return to all comments →
MS SQL using WITH