SQL Group By Sub Query -


i dont understand sub queries on how can accessed outer query, need question. here 4 schema's.

movie(title, year, director, budget, earnings) actor(stagename, realname, birthyear) actedin(stagename, title, year, pay) canworkwith(stagename, director) 

find name(s) of actors(s) highest pay acting in movie. got, asking find highest paid actor each movie...but on second thought brackets may indicate has been paid highest , maybe couple have same amount. anyways..

what have

select a.realname actedin a.stagename in ( select a1.title, a1.year, max(pay)                        actedin a1                        group title, year ) 

i know a.stagename in wrong, have no idea how link back.

this should enough if understood :

select a.realname actedin pay = (select max(pay) actedin b b.stagename = a.stageman) 

Comments

Popular posts from this blog

django - How can I change user group without delete record -

java - Need to add SOAP security token -

java - EclipseLink JPA Object is not a known entity type -