CREATE TABLE #YourTable ([name] varchar(8), [salary] int) ;

0

Please login or register to vote for this query.

(click on this box to dismiss)

Stack Overflow

Q&A for professional and enthusiast programmers

CREATE TABLE #YourTable
    ([name] varchar(8), [salary] int)
;
    
INSERT INTO #YourTable
    ([name], [salary])
VALUES
    ('Husain', 20000.00),
    ('Husain', 20000.00),
    ('Husain', 20000.00),
    ('Munavvar', 50000.00),
    ('Munavvar', 50000.0)
;

   DELETE T1
    FROM #YourTable T1 WITH(TABLOCKX)
    WHERE CAST(T1.%%physloc%% AS BIGINT)
    NOT IN (SELECT MAX(CAST(%%physloc%% AS BIGINT))
    FROM #YourTable
    GROUP BY Name, Salary
     )
            
  SELECT *
  FROM #YourTable

Enter Parameters

Options:
Switch to meta site
loading Hold tight while we fetch your results