Q:

SQL - Select column value if other value is not present

I have a query in SQL designed like below:
Column A    Column B    Column C
Mary               24             First 
Mary               25             Second
Paul                5             First 
Tim             1             Second

I want to return all rows with "First" in column C, and rows with "Second" only if it does not have corresponding "First" value based upon column A. So I'd like to see:
Mary 24
Paul 5
Tim 1

I've tried Case statements and If statements, but can't get it to work. Any suggestions?

A:

Here is one trick using ROW_NUMBER
SELECT * FROM 
(
SELECT * , ROW_NUMBER()OVER(PARTITION BY [Column A] ORDER BY [Column C] ASC) RN
FROM TableName
) A
WHERE RN = 1

Alphabetically F comes before S so the row number 1 will be assigned to First. If First is not present then 1 will be assigned to Second

