In a single table,How to retrieve a employee-id of an
employee who works in more than one department?
Answers were Sorted based on User's Feedback
Answer / venkat
SELECT EMPLOYEE-ID FROM EMPLOYEE GROUP BY EMPLOYEE-ID,DEPARTMENT HAVING COUNT( DEPARTMENT ) > 1;
| Is This Answer Correct ? | 0 Yes | 2 No |
Answer / karthik
select dept,empid , count(*)
from table
goup by dept,empid
having count(*) > 1
| Is This Answer Correct ? | 0 Yes | 3 No |
Answer / g.kameswara reddy
select employee_id from employee table where department in
('a1','a2','b1','b2');
| Is This Answer Correct ? | 7 Yes | 11 No |
Answer / prasenjit_in
Select emp_id from employee where dept IN (select all
dept from employee);
| Is This Answer Correct ? | 4 Yes | 9 No |
Answer / ab
Select emp_id from employee where dept IN (select DISTINCT
dept from employee);
| Is This Answer Correct ? | 2 Yes | 8 No |
What is a lock?
What is package versioning? Please give an example.
List out the data types available.
What is the logical entity between plan and Package?
What is the significance of the CURSOR WITH HOLD clause in a cursor declaration?
How could one combine a set of incremental image copies into a single copy?
What is the difference between cursor and select statement?
What are the disadvantages of using VARCHAR?
What is multi row fetch in db2?
Which catalog tables contain authorization information?
What is a synonym ?
What is the role of union all and union