Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

SELECT DISTINCT

Status
Not open for further replies.

gustaf111

Programmer
Jan 16, 2011
87
SE


SELECT DISTINCT (Name), Computer, FROM table1;

Hello, I have a table that contains two colums, Name and Computer. I would like to list the name only ones and display the corresponding value to the Name.

Example

Name Computer
=====
Andy Data1
Andy Data2
Nick Data1
Nick Data2
Marget Data1


I would like to have the result:
Andy Data1
Nick Data1
Marget Data1

How do I do that ? Please Help!!





 
Code:
SELECT name
     , MIN(Computer)
  FROM daTable
GROUP
    BY name
i should note in passing that DISTINCT is ~not~ a function, so please don't go putting parentheses around the first column that comes after the DISTINCT keyword

r937.com | rudy.ca
Buy my new book Simply SQL from Amazon
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top