0

Group By without getting raw data

I'm looking for the Jet equivalent to a GROUP BY. A simple example:

SELECT [Vendor No_], COUNT(1) AS [Num Items]
FROM [dbo].[Item] 
GROUP BY [Vendor No_]
In Jet, I can do:
E5:
=NL("Rows","Item","Vendor No.","+Vendor No.","<>@@")
F5:
=NL("Count","Item",,"Vendor No.",$E5)

But that actually runs a single SQL query for every line. Not so bad when there are only a few hundred, but if there are thousands or tens of thousands of groups, it's slow for both the Excel side and also the SQL side.

From what I can tell, I can do this with grouping and subtotaling, but it needs all the raw data upfront, which is not great when there are hundreds of thousands of actual records.

Is there a way to group in advance in a single statement like you can in SQL?

2 comments

Please sign in to leave a comment.