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
How do I debug a stored procedure in sql server?
What to check if a User database is locked?
If you're given a raw data table, how would perform etl (extract, transform, load) with sql to obtain the data in a desired format?
How to get a list of columns using the "sp_help" stored procedure in ms sql server?
When should you use an instead of trigger?
Explain hostprotectionattribute in sql server 2005?
Is null in sql server?
optimization techinques
When does a workload on SQL Azure get throttled?
what is the difference between them (ethernet networks and token ring networks)? : Sql server database administration
How do I run a trace in sql server?
Explain the microsoft sql server delete command? : SQL Server Architecture
How to view existing indexes on an given table using sys.indexes?
What are alternate keys?
What is user defined datatypes and when you should go for them?