Does Group By also perform Sorting?

mdlueck

Sr. Application Developer
Local time
Today, 08:04
Joined
Jun 23, 2011
Messages
2,650
I am suspicious that in Access, Reports Group On behaves differently than in SQL RDBMS's. I have an Access Report which in the "Group, Sort, and Total" pane has the following:

Code:
Group on: vendorid
  Sort by: vendortitle
    Sort by: partnumber
I was expecting the first to simply group all of the like vendorid values. Then for the next operation to perform alphabetical sorting of vendor names.

Presently the report is not alphabetically sorted by vendor name.

Digging into the "Group on" row within the Report designer, I see "from smallest to largest" in the same row. rrrr??? What does "Group on" have to do with also Sorting?!?!?!

What is the work-around to have Access behave the way SQL RDBMS's work?
 
I cannot see how a report can be anything other than sorted by group, although sorting within the group might be by vendorname.

Brian
 
I cannot see how a report can be anything other than sorted by group, although sorting within the group might be by vendorname.

I did a slight-of-hands workaround...

Code:
Sort by: vendortitle
  Group on: vendorid
    Sort by: partnumber
In SQL RDBMS's, GROUP BY does absolutely no ORDER BY behavior. So just having a GROUP BY in a query provides context for GROUP based functions, like perhaps a SUM. A separate ORDER BY clause is needed to put the records in the result set in any particular order.
 

Users who are viewing this thread

Back
Top Bottom