Advertisement
Guest User

Untitled

a guest
Mar 5th, 2015
183
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.31 KB | None | 0 0
  1. select d.name, e.id from Employee e
  2. join Departament d on d.id = e.dep_id
  3. where e.id = (
  4. select s.eid from (
  5. select ee.id as eid, @rowid:=@rowid+1 as rowid from Employee ee, (SELECT @rowid:=0) as init
  6. where ee.dep_id = d.id
  7. order by ee.salary desc
  8. ) s
  9. where s.rowid = 5
  10. )
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement