Query to return mimimun values in from a table

plannerg

Registered User.
Local time
Tomorrow, 06:32
Joined
Oct 19, 2005
Messages
23
Hi,

I have a table with a sporting matchID, stat transaction number, and a stat code linked to the transaction number.

I would like to create a query that returns the minimum transaction number of a particular stat code for each matchID. Is there an easy way to do this?

Each matchID has 1000 or so transaction numbers associated to it, with those transaction numbers having different stat codes associated to them.

I am hoping this isnt to complicted and that some one may be able to point me in the right direction.

Thanks Greg.
 
I'm not sure what level of Access user you're at.

Basically, the SQL command you want to look at is Min().

You can write a query in the query designer pretty easily. When you've got the query working in the query designer, click on group by and select Min() for the column you want the minimum for.

HTH.
 
Code:
SELECT Table1.MatchId, Table1.[Stat Code], Min(Table1.[Stat Transaction Number]) AS [MinOfStat Transaction Number]
FROM Table1
GROUP BY Table1.MatchId, Table1.[Stat Code]
replace table1 with your table name
 
khawar

That worked beautifully. Thanks for your assistance.
 

Users who are viewing this thread

Back
Top Bottom