You didn't say this, but for this to work I have to assume you have a CustNo
field in the tblSalesInfo table.
[Customers].[CustNo],[tblSalesInfo].[Year],[tblSalesInfo].[Total]
Try this code in the criteria section of the Total column in the query
In (Select Top 10 S.[Total]
FROM tblSalesInfo AS S
Where S.[Year] = [TblSalesInfo.[Year]
Order By S.[Total] DESC)
Assumption is that your entrie SQL would look like
SELECT [Customers].[CustNo], [tblSalesInfo].[Year], [tblSalesInfo].[Total]
FROM Customers INNER JOIN tblSalesInfo
ON Customers.CustNo = tblSalesInfo.CustNo
WHERE tblSalesInfo.Total In
(Select Top 10 S.[Total]
FROM tblSalesInfo AS S
Where S.[Year] = [TblSalesInfo.[Year]
Order By S.[Total] DESC)
Hanksor said:
It worked, sort of. I doesn't give me the top 10 though. It returns all
records.
The query consists of;
[Customers].[CustNo],[tblSalesInfo].[Year],[tblSalesInfo].[Total]
I put this code in the criteria section of the Total column in the query;
In (Select Top 10 [Total] From tblSalesInfo Where
[CustNo]=[Customers].[CustNo] Order By [Total] DESC)
I have two tables.
[Customers]
CustNo
CustomerName and
[tblSalesInfo]
Year
Total
I would like to be able to return the top 10 Total for each year. Any help
will be appreciated.
David S via AccessMonster.com said: