hp5110
hp5110

Reputation: 11

SQL: selecting one of multiple records

I have a table

Name   Number 
--------------
A        1 
A       Null 
A        2
B       Null 
B       Null 

Output I want is

Name.    Number 
B.        Null 

I just want records that just have null value

Upvotes: 0

Views: 30

Answers (1)

bendataclear
bendataclear

Reputation: 3850

You should be able to use grouping and a having clause

select Name, max(Number) as Number
from Table
group by Name
having max(Number) is null

Upvotes: 3

Related Questions