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
What is cdc in sql server?
What is primary key and example?
What do you think of this implementation? Can this be implemented better?
what are defaults? : Sql server database administration
How do I edit a procedure in sql server?
Tell me something about security and sql azure?
What is subquery explain with example?
Tell me the difference between clustered and non-clustered index?
What is Lock table in SQL?
What the different types of Replication and why are they used?
What are rows and columns?
I create a separate index on each column of a table. What are the advantages and disadvantages of this approach? : Sql server database administration
How many types of relations are there between dimension and measure group? : sql server analysis services, ssas
What is a mutating table error and how can you get around it?
How to stop a loop early with break statements in ms sql server?