Their are two tables 'A' and'B'.Table 'A' contains 3 columns
named 'eid','ename','dept'.
Table 'B'contains 3 columns
named'sid','designation','salary'.
We have to retrieve the names of employees working in the
same department,same designation and same salary.
Its urgent can anyone help me out in this problem.

Answer Posted / jeya

select Emp.* , sal.*
From Emp
Inner Join Sal On Emp.EmpId = sal.EmpId
Inner Join (
Select X.Department , sal.Designation , sal.salary
From Emp
Inner join (
Select Department
From emp Group By Department Having COUNT(*) > 1
)As X On X.Department = Emp.Department
Inner Join Sal On sal.EmpId = emp.EmpId
Group by X.Department , sal.Designation , sal.salary
Having COUNT(*) > 1
)as y on y.Department = emp.Department and y.Designation =
sal.Designation
and y.salary = Sal.salary

Is This Answer Correct ?    3 Yes 7 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

List down some advantages of sql stored procedure?

555


What is cube dimension? : sql server analysis services, ssas

534


Mention the different types of triggers?

547


Difference between Logical Page and Physical Page in SSRS.

340


what is the sql equivaent of the dataset relation object ?

1567






How to insert and update data into a table with "insert" and "update" statements?

508


What is dbcc?

733


Explain what is public role in sql server?

580


What is scalar user-defined function?

548


What is normalization of database? What are its benefits?

515


define and explain the differences between clustered and non-clustered indexes.

599


As per your opinion what are the five top responsibilities of a dba? : sql server database administration

612


How many types of functions are there in sql server?

459


Explain stored procedure?

596


What is efficiency data?

520