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!

only showing the first in a group

Status
Not open for further replies.

ovie52

Technical User
Feb 5, 2002
11
0
0
GB
my query results in a situation like this:

name letter color

keith a blue
john b green
kate c yellow
kate c yellowx

i don't want to see the row which has 'yellowx'.

I want the query to only show me the first row in a group of rows where 'name' & 'letter' are the same.

Can anyone help?
 
A totals query, e.g.

SELECT tblColors.name, tblColors.letter, First(tblColors.color) AS FirstOfcolor
FROM tblColors
GROUP BY tblColors.name, tblColors.letter
ORDER BY tblColors.letter;

Using Max/Min or First/Last will do this for you, but a question would be "...in choosing between 'yellow' and 'yellowx', do you want the first response submitted, the longest name, or what?"

Bob
 
Hello Ovie,

SELECT Table.fld1, Table.fld2, First(Table.fld3) AS FirstOffld3
FROM Table
GROUP BY Table.fld1, Table.fld2;

******************************************************

In this example fld1 = name
fld2 = letter
fld3 = color
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top