P
PJFry
I am working on a project where I want to select the max count from a table.
I can do it by writing a subquery to group and count the items and then a
query to select the max count.
Here is the subquery, named sqCntOrders:
SELECT Count(order_id) as Cnt FROM tOrders
GROUP BY order_id;
And here is the query that pulls the max value from the query above
SELECT Max(sqCntOrders.Cnt) AS MaxOfCnt
FROM sqCntOrders;
How can I combine these into a single query, if I can at all?
The end result is going to be a VBA recordset where that max value is passed
to be used in a case statement.
I would also be interested in hearing a simpler way to do this
I am using A2007.
Thanks!
PJ
I can do it by writing a subquery to group and count the items and then a
query to select the max count.
Here is the subquery, named sqCntOrders:
SELECT Count(order_id) as Cnt FROM tOrders
GROUP BY order_id;
And here is the query that pulls the max value from the query above
SELECT Max(sqCntOrders.Cnt) AS MaxOfCnt
FROM sqCntOrders;
How can I combine these into a single query, if I can at all?
The end result is going to be a VBA recordset where that max value is passed
to be used in a case statement.
I would also be interested in hearing a simpler way to do this
I am using A2007.
Thanks!
PJ