user3793478
user3793478

Reputation: 47

How do I get distinct grouped data?

For the following table structure:

Name   |     ID
john       111111111
robert     222222222
robert     333333333
jack       444444444
stewart    555555555
stewart    666666666
lana       777777777

How can I return the following output using a select query:

john      111111111
robert    222222222
jack      444444444
steware   555555555
lana      777777777

Upvotes: 0

Views: 33

Answers (1)

Hugh Jones
Hugh Jones

Reputation: 2694

select Name, Min(ID)
from table1
Group by name

Upvotes: 3

Related Questions