Help me with Oracle sqlplus query.....

tsj

tsj

Permabanned
Joined
7 May 2004
Posts
1,051
Location
United Kingdom
Hey guys... I've got a STAFF table and I need to...

"For each manager, show the staff (& appropriate staff details) for whom they are the manager and present the result grouped as appropriate ie. Branch_ID"

I would have thought it would have been...

select staff_id, staff_name, staff_job, branch_id
from staff
group by branch_id

Some example data in the table is:
Staff_id Staff_name Staff_job Branch_id
1 Bob Manager 1
2 Dave Assistant 1
3 John Manager 2
4 Andrew Assistant 2
5 Sarah Assistant 2

but it doesnt work...

I'm hoping that it groups the following(because their branch_id's are the same... hence they are at the same branch):

1 Bob Manager 1
2 Dave Assistant 1

and:

3 John Manager 2
4 Andrew Assistant 2
5 Sarah Assistant 2
 
Can you elaborate on "it doesn't work"? Doesn't help when we don't have much info :p

Whats the error message, if any? Are you sure its asking you to return values from 1 table only? In this case the Staff table.
 
I don't have access to Oracle at home... so couldnt post the error... from what I can tell the question only requires from table unless it wants me to join two tables which i dont think i'd need to
 
Back
Top Bottom