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
You want to implement the many-to-many relationship while designing tables. How would you do it?
What is a result set object returned by odbc_exec()?
Write a query for primary key constraint with identity key word?
How to use "begin ... End" statement structures in ms sql server?
How use inner join in sql server?
What are a database and a data warehouse?
How to update values in a table with update statements in ms sql server?
What are the differences between stored procedure and the dynamic sql?
What is factless fact table? : sql server analysis services, ssas
How can change procedure in sql server?
What are the five characteristics of good data?
What are cursors? Explain the different types of cursors Enlist a few disadvantages of cursors.
What are commit and rollback in sql?
What is DCL?
Can I save my report as html, excel or word? : sql server management studio