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

Answer Posted / anonymous

select emp_id from employee where dept in (select distinct
dept from employee) group by emp_id having count(*) >1;

Is This Answer Correct ?    0 Yes 2 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

How is deadlock resolved?

650


List out the three types of page locks that can be held.

689


How can we retrieve the total number of records in RPG & CLLE?

203


How do I optimize a query in db2?

624


Which component is responsible for processing sql statements and selecting access paths?

671






What types of tables are there in the db2 database?

559


What is db2 instance?

594


What are the benefits of using the db2 database?

662


How do I delete a table in db2?

651


Explain correlated sub-queries.

589


What is the picture clause of null indicator variable?

694


What is db2 look?

581


How to check sequence on a table in db2?

602


How to check last update on table in db2?

629


by using cursors , we can access particular records from the table based on some condition, i want to delete those selected records, how can we write a query for this in the program?

7523