I need to get the Top 2 records per Customer AND Product. So my data looks like this...
Customer ProdCode
-------- --------
Cust1 PROD1
Cust1 PROD1
Cust1 PROD1
Cust1 PROD1
Cust1 PROD2
Cust1 PROD2
Cust1 PROD2
Cust1 PROD2
Cust1 PROD2
Cust2 PROD1
Cust2 PROD1
Cust2 PROD1
Cust2 PROD1
Cust2 PROD1
but I want it to look like this...
Customer ProdCode
-------- --------
Cust1 PROD1
Cust1 PROD1
Cust1 PROD2
Cust1 PROD2
Cust2 PROD1
Cust2 PROD1
I've found a number of examples of Top N per Group but not for two columns.
You cannot get the displayed result from the data shown. Access provides matches for top N and your data has multiple matches, so these will be returned. It may be possible to get the required result with more realistic data, as there are several workarounds that can force an exact return.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.