Collections:
Use Multiple Columns in GROUP BY in Oracle
Can Multiple Columns Be Used in GROUP BY in Oracle?
✍: FYIcenter.com
You can use multiple columns in the GROUP BY clause as shown in the following example. It returns how many employees are having the same salary in each department:
SQL> SELECT department_id, salary, count(*)
2 FROM employees GROUP BY department_id,
3 salary HAVING count(*) > 1;
DEPARTMENT_ID SALARY COUNT(*)
------------- ---------- ----------
90 17000 2
50 3200 4
50 2200 2
50 3600 2
80 10500 2
80 9000 2
50 2700 2
......
⇒ Use Group Functions in ORDER BY Clause in Oracle
⇐ Count Duplicated Values in a Column in Oracle
2019-10-27, 2399🔥, 0💬
Popular Posts:
How To End a Stored Procedure Properly in SQL Server Transact-SQL? Where the end of the "CREATE PROC...
What Are the Underflow and Overflow Behaviors on FLOAT Literals in SQL Server Transact-SQL? If you e...
How To Break Query Output into Pages in MySQL? If you have a query that returns hundreds of rows, an...
How To Start MySQL Server in MySQL? If you want to start the MySQL server, you can run the "mysqld" ...
What Happens to Your Transactions When ERROR 1205 Occurred in MySQL? If your transaction receives th...