Home » SQL & PL/SQL » SQL & PL/SQL » Cannot group third column (Querying)
Cannot group third column (Querying) [message #645504] Mon, 07 December 2015 12:12 Go to next message
fabi88
Messages: 112
Registered: November 2011
Senior Member
I am doing a query to find the total number of staff at each football stadium and their managers. So far I am able to output the total number of staff for each stadium, however i need to show the manager as well for each stadium. Can someone help me on this, as i don't know how to include the manager. The manager is in a table called stadium under column "manager_no".

My code:

select count(staff_no) as "Total Staff", stadium_no
from staff
where stadium_no = 100 or stadium_no = 200
group by stadium_no;
Re: Cannot group third column (Querying) [message #645506 is a reply to message #645504] Mon, 07 December 2015 12:22 Go to previous messageGo to next message
BlackSwan
Messages: 26766
Registered: January 2009
Location: SoCal
Senior Member
Please read and follow the forum guidelines, to enable us to help you:
OraFAQ Forum Guide
How to use {code} tags and make your code easier to read
Re: Cannot group third column (Querying) [message #645507 is a reply to message #645504] Mon, 07 December 2015 12:41 Go to previous messageGo to next message
Michel Cadot
Messages: 68776
Registered: March 2007
Location: Saint-Maur, France, https...
Senior Member
Account Moderator

Please read OraFAQ Forum Guide and How to use [code] tags and make your code easier to read.
Also always post your Oracle version, with 4 decimals.

With any SQL or PL/SQL question, please, Post a working Test case: create table (including all constraints) and insert statements along with the result you want with these data then we will be able work with your table and data. Explain with words and sentences the rules that lead to this result.
Re: Cannot group third column (Querying) [message #645508 is a reply to message #645504] Mon, 07 December 2015 13:45 Go to previous message
John Watson
Messages: 9002
Registered: January 2010
Location: Global Village
Senior Member
You could perform the aggregation on a view that joins your STAFF and STADIUM tables.
Previous Topic: Subqyery with group by / case when / having
Next Topic: Help with insert
Goto Forum:
  


Current Time: Sat Jun 27 19:37:54 CDT 2026