Hi guys,

I'm wondering if there is a way to solve this problem. Currently, I have an SQL statement that goes this way:

SELECT distinct name,id from list

My understanding is that it selects the things that are distinct on both tables.
Example:
id name
1 Joe
2 Joe


It will return to me the two rows because although the name is the same, the ids are not. Is there an SQL statement that will allow me to select a distinct name and still grab the id field? Basically I want to

SELECT distinct name from list

but grab the id too. In the previous example, it should just return 1 name with either of the ids.

Recommended Answers

All 2 Replies

Thanks a lot. That did the trick!

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.