Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- select d.name, e.id from Employee e
- join Departament d on d.id = e.dep_id
- where e.id = (
- select s.eid from (
- select ee.id as eid, @rowid:=@rowid+1 as rowid from Employee ee, (SELECT @rowid:=0) as init
- where ee.dep_id = d.id
- order by ee.salary desc
- ) s
- where s.rowid = 5
- )
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement