Can Group Functions Be Mixed with Non-group Selection Fields?
Page 1 of 1
Can Group Functions Be Mixed with Non-group Selection Fields?
If a group function is used in the SELECT clause, all other selection fields must be group level
fields. Non-group fields can not be mixed with group fields in the SELECT clause. The script
below gives you an example of invalid SELECT statements with group and non-gorup selection
fields:
SQL> SELECT COUNT(*), department_id FROM departments;
ORA-00937: not a single-group group function
In this example, COUNT(*) is a group field and department_id is a non-group field.
fields. Non-group fields can not be mixed with group fields in the SELECT clause. The script
below gives you an example of invalid SELECT statements with group and non-gorup selection
fields:
SQL> SELECT COUNT(*), department_id FROM departments;
ORA-00937: not a single-group group function
In this example, COUNT(*) is a group field and department_id is a non-group field.
Similar topics
» What Are Group Functions?
» Can Multiple Columns Be Used in GROUP BY?
» Can Group Functions Be Used in the ORDER BY Clause?
» How To Apply Filtering Criteria at Group Level?
» How To Count Groups Returned with the GROUP BY Clause?
» Can Multiple Columns Be Used in GROUP BY?
» Can Group Functions Be Used in the ORDER BY Clause?
» How To Apply Filtering Criteria at Group Level?
» How To Count Groups Returned with the GROUP BY Clause?
Page 1 of 1
Permissions in this forum:
You cannot reply to topics in this forum
Sun Jan 31, 2010 12:35 am by Micheal
» Accessing tables of other users in SQL
Sun Jan 31, 2010 12:34 am by Micheal
» Grouping commands in SQL
Sun Jan 31, 2010 12:32 am by Micheal
» Operations on Result Sets in SQL
Sun Jan 31, 2010 12:31 am by Micheal
» Subqueries in SQL
Sun Jan 31, 2010 12:30 am by Micheal
» Joining Relations in SQL
Sun Jan 31, 2010 12:28 am by Micheal
» Delete comand in SQL
Sun Jan 31, 2010 12:27 am by Micheal
» Update command in SQL
Sun Jan 31, 2010 12:26 am by Micheal
» Insert command in SQL
Sun Jan 31, 2010 12:23 am by Micheal