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 / patan

WE HAVE TABLE A (EID,ENAME,DEPT) AND TABLE B (NAMED,SID,DESIGNATION,SALARY)

--WE WANT TO RETRIEVE FOLLOWING
SELECT
B.NAMES AS NAMES
,B.DEPT AS DEPARTMENT
,B.SALARY AS SALARY
,B.DESIGNATION AS DESIGNATION

FROM TABLEA AS A
LEFT JOIN TABLEB AS B
ON A.EID=B.SID
ORDER BY B.NAMED


NOTE:WHEN WE ARE USING LEFT JOIN IT WILL MATCH THE RECORDS FROM BOTH THE TABLES AND LEFT TABLE OF RECORDS WILL DISPLAY...THAT ONLY I DID HERE

TRY IT..SURE IT WILL USEFUL

Is This Answer Correct ?    0 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What is page in sql server?

594


Why use stored procedures in sql server?

622


When is the use of update_statistics command?

638


what is a join? : Sql server database administration

638


Will the writetext statement activate a trigger?

641






What are the types of user defined functions in sql server?

594


Does sql server 2000 clustering support load balancing?

660


Explain an automatic checkpoint

647


What stored by the master?

635


Tell me when is the update_statistics command used?

596


Is it possible for a stored procedure to call itself or recursive stored procedure?

597


What is it unwise to create wide clustered index keys?

663


What are window functions in sql server?

596


What do you understand by integration services in sql server?

644


What are the extra roles available in msdb? : sql server security

740