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 |
How do you retrieve the first 5 characters of firstname column of db2 table emp?
how we will do null data selection in cobol-db2 program
How is the value function used?
What is the difference between dbm cfg and db cfg file in db2 ?
What technique is used to retrieve data from more than one table in a single SQL statement?
When a COBOL-DB2 program in PRODUCTION is updating main tables and gone for long run, what have to do?
why should we bind the DB2 program . What if we did not BIND a BD2 program ??
9 Answers Infosys, TCS, Xansa,
What is db2 instance?
What is difference between isnull and coalesce?
Mention the various locks that are available in db2.
Suppose there are many duplicate records in a Db2 table. What is the query to retrive only duplicate records?
What's the maximum number of volumes that can be added to a STOGROUP?