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 Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Get other rows from DISTINCT satement

Status
Not open for further replies.

dave796

Technical User
Aug 21, 2005
11
I am trying to display a set of records based on a SELECT DISTINCT Field1 statement, however I would like to display other fields in the record without it being assessed if they are distinct from another record or not. (i.e NOT DISTINCT Field1, Field2). I should note it doesn't matter at all what record set is displayed as long as all Field1's are distinct. Is this possible or am I going to have to work around it.
 
Simply use aggregate function (like Min or Max):
SELECT Field1, MIN(Field2), MIN(Field3)
FROM yourTable
GROUP BY Field1

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ181-2886
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top