A Microsoft extension to the ANSI SQL language that includes procedural programming, local variables, and various support functions.
Hi @Akshay ,
Welcome to Microsoft Q&A!
You could use Viorel's answer which is the best one.
Please also refer below as alternative approaches:
select distinct Steam_Id, count( Skin_name) over (partition by Steam_Id) Skin_name
from (select distinct * from mytable) a
OR
SELECT distinct Steam_Id,dense_rank() over (partition by Steam_Id order by Skin_name) + dense_rank() over (partition by Steam_Id order by Skin_name desc) - 1 Skin_name
FROM mytable
Output:
Steam_Id Skin_name
steam_id 1 3
steam_id 2 3
Best regards,
Melissa
If the answer is helpful, please click "Accept Answer" and upvote it.
Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.