In a single table,How to retrieve a employee-id of an
employee who works in more than one department?

Answer Posted / millar

select employee_id,department_id from emp where employee_id in(select employee_id from emp where department_id in (select distinct
department_id from emp) group by employee_id,department_id having count(*) >1);

Is This Answer Correct ?    0 Yes 1 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

Is db2 a mainframe database?

569


How to test SQL -911 error while developing COB-DB2 program

6721


What is buffer pool in the db2 database?

622


What are host variables in db2?

628


What is db2 stogroup?

679






What is db2 instance?

594


What language is db2 written in?

596


What is image copy in db2?

575


Is ibm db2 free?

578


What is universal database?

622


What os does db2 run on?

574


How does db2 sample database connect?

572


How to create backup table in db2?

646


Where can you declare a cursor in a cobol-db2 program?

605


What is bind plan?

616