Hy,
I do have a query for a table which shows different entries for different usernames. But there are multiple entries for each username and I want to show only one entry for each username. My query looks like that:
SELECT Time AS 'Login', 
    User_Name  AS 'Username', 
    CASE 
    [User_Name] WHEN ('Demo') THEN 'Special' 
    ELSE 'Standard' END AS Usertype
    FROM table1
Is there a way to show only one entry for each username? I already tried out with "GROUP BY" but it didn´t work. Maybe someone could help me.
With this I would get the correct output, but is it anyhow possible to combine the two SELECTS?
WITH cte AS
    (
   SELECT *,
         ROW_NUMBER() OVER (PARTITION BY Username ORDER BY Username DESC) AS rn
   FROM table1
    )
    SELECT *
    FROM cte
    WHERE rn = 1
