INF: GROUP BY Function Only Returns Rows

ID Number: Q63868

1.10 1.11 4.20

OS/2

Summary:

The following is an explanation of why the GROUP BY function only

returns rows.

The GROUP BY function requires that all items in the select list

either be aggregates or have the same value for all members of the

group. This is because the GROUP BY function returns a single row for

the entire group and there is no way to display different values for

individual members of the group.

If the select list includes items that cannot be summarized into a

single line for the entire group, SQL Server returns a row for each

individual member of the group. If a HAVING clause is present, it is

ignored because it is applicable only when the GROUP BY function is

used.

Additional reference words: 1.10 1.11 4.20 Transact-SQL