So I know this is a pretty dumb question, however (as the rather lengthily title says) I would like to know how do the following:
I have a table like this:
Another option would be something along the lines of the following:
DECLARE @TEST TABLE( ID int, Foo int, Bar int, Blagh int)
INSERT INTO @TEST VALUES (1,10,20,30)
INSERT INTO @TEST VALUES (2,10,5,1)
INSERT INTO @TEST VALUES (3,20,50,70)
INSERT INTO @TEST VALUES (4,20,75,12)
SELECT Id, Foo, Bar, Blagh
FROM (
SELECT id, Foo, Bar, Blagh, CASE WHEN (Min(Bar) OVER(PARTITION BY FOO) = Bar) THEN 1 ELSE 0 END as MyRow
FROM @TEST) t
WHERE MyRow = 1
Although this still requires a sub-query it does eliminate the need for joins.
Just another option.