Oracle sql query returning all of the values instead limiting the values -


full disclosure part of homework question have tried 6 different versions , stuck. trying find 1 manager every time query runs. i.e put department id in , 1 name pops out. currently, names, multiple times. have tried nesting '=' not nesting, union, intersection, etc. can manager id basic query, can't name. current version looks this:

select e.ename .emp e d.managerid in (select unique  d.managerid                        works w, .dept d, emp e1 d.did=1 , e1.eid=w.eid , d.did=w.did ); 

i realize basic mistake not seeing - ideas?

its not clear mean 1 menager time. should different menagers time or same?

lest go throw query:

  1. you select empolyes table emp manager_id in next query dataset
  2. you managers dep=1. rest of tables , conditions not influent on result dataset.

i theing did primary key table dept, if query may rewritten

select e.ename emp e d.managerid in (select unique  d.managerid                        dept d                       d.did=1); 

but query return emploees , not manager dept=1 , if need manager. should emploee manager. if eid primary key of employee, , managerid id employee table need like:

select e.ename emp e e1.eid in (select unique  d.managerid                        dept d                       d.did=1); 

Comments

Popular posts from this blog

java - SSE Emitter : Manage timeouts and complete() -

jquery - uncaught exception: DataTables Editor - remote hosting of code not allowed -

java - How to resolve error - package com.squareup.okhttp3 doesn't exist? -