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
"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