I have a report that is based on a query. In the detail section of the report I want to limit the number of detail lines to top N. (like a select TOP N type query). In this sample I want the top 2 rows. Query I have so far is
SELECT TestTable.[GroupByCol], TestTable.[DetailColA]
FROM TestTable group by TestTable.[GroupByCol], TestTable.[DetailColA]
I know I need to join and do some having and count but it’s just not clicking. I have also attached a screenshot.
Please advise. thank you

Try the following query as your report recordsource:
See Allen Browne’s Subquery Basics for more information.
EDIT: As you alluded to in your comment, this can also be written as follows:
You would have to benchmark to be sure, but this second version is probably more efficient. Which is more readable is probably a matter of personal preference (I find the first version more intuitive and readable).