Quantcast
Channel: Transact-SQL forum
Viewing all articles
Browse latest Browse all 23857

Query help

$
0
0

Hi I have a table like:

DECLARE @Employee Table(Title varchar(10),Name varchar(50),Level int)
INSERT INTO @Employee VALUES ('Admin','Dave',2)
INSERT INTO @Employee VALUES ('Engineer1','Allysis',4)
INSERT INTO @Employee VALUES ('Engineer2','David',4)
INSERT INTO @Employee VALUES ('Engineer3','Peter',4)
INSERT INTO @Employee VALUES ('Engineer3','Mark',5)
INSERT INTO @Employee VALUES ('Engineer2','John',5)
INSERT INTO @Employee VALUES ('Engineer3','Ronda',6)
INSERT INTO @Employee VALUES ('Owner','Brent',2)
INSERT INTO @Employee VALUES ('Owner','Andrew',2)
INSERT INTO @Employee VALUES ('Owner','Hatton',2)
INSERT INTO @Employee VALUES ('Admin','Tom',2)
INSERT INTO @Employee VALUES ('Admin','Center',2)
INSERT INTO @Employee VALUES ('Admin','Bill',2)

SELECT * FROM @Employee

I need to filter out any duplicates in the Title column by keeping the highest Level.

OutPut:


Viewing all articles
Browse latest Browse all 23857

Trending Articles