Oracle group by test statement SQL code www.2cto.com create table test (a VARCHAR2 (20), B VARCHAR2 (20), c NUMBER, d VARCHAR2 (20 )) insert into test VALUES ('a1', 'b1', 1, 'T'); insert into test VALUES ('a3', 'b3', 3, 'T '); insert into test VALUES ('a4 ', 'b4', 4, 'T'); insert into test VALUES ('a2 ', 'b2', 2, 'T '); insert into test VALUES ('XX', 'XX', 5, 'x'); insert into test VALUES ('a1', 'b1 ', 1, 'T '); insert into test VALUES ('a3 ', 'b3', 3, 'T'); insert into test VALUES ('a4', 'b4 ', 4, 'T '); insert into test VALUES ('a2 ', 'b2', 2, 'T'); insert into test VALUES ('XX', 'XX', 5, 'x '); COMMIT; 1. SELECT a, B, SUM (c) FROM test WHERE d = 't'group BY a, B order by a, B; 2. SELECT a, B, SUM (c) FROM test WHERE d = 't'group BY B, a order by a, B; Conclusion: for 1, 2, the results should be the same, however, the SQL Performance may vary depending on the grouping order.