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

Explain what is public role in sql server?

678


‘Order by’ is not allowed in a view how can you sort information from a view?

693


List some of the rules that apply to creating and using a ‘view’

605


What are the new features introduced in SQL Server 2000? What changed between the previous version of SQL Server and the current version?

1934


How to encrypt Strored Procedure in SQL SERVER?

642






Explain the creation and execution of a user-defined function in the sql server?

680


What is a livelock?

640


What are the commands used in DCL?

641


What is usually the first word in a sql query?

708


You want to generate a report that is formatted as a chart. Can you use the report wizard to create such a report?

92


What are the system database in sql server 2005?

641


What will happen if a column containing char type data is changed to the nchar data type?

704


How do I view a script in sql server?

626


whats the maximum size of view state??

1814


How to perform key word search in tables?

609