sql - If I need to check if all instances of a tuple are true and return the values of those that are how should I start? -


the question asks me find managers @ specific company have been employed more of more subordinate staff. st_name persons name, st_hiredate when hired , st_possition if manager, assistant or supervisor.

when run query below correctly tuples need make comparison can't run produce tuples of managers hired after of junior staff.

is there condition can use says if instances of staff member's name not same instances of hire date being before junior staff don't return name?

select a.st_name, a.st_hiredate, b.st_name, b.st_hiredate (select st_name, st_hiredate, st_position staff st_position = 'assistant' or st_position = 'supervisor') b join (select st_name, st_hiredate, st_position staff st_position = 'manager') a; 

there 17 staff 6 of managers , 11 of not. when run above query brings 66 tuples means accurately comparing each manager against each of subordinates. how state must greater every other subordinate staff member?

try kind of query not sure of syntax.just idea.

select * staff st_position='manager' , st_hiredate >(select max(st_hiredate)  staff st_position='supervisor' or st_position='assistant' ) 

Comments

Popular posts from this blog

linux - Does gcc have any options to add version info in ELF binary file? -

android - send complex objects as post php java -

charts - What graph/dashboard product is facebook using in Dashboard: PUE & WUE -