SQL Server - Select columns from Two table
Asked By Gunasundari Loganathan on 13-Mar-13 08:12 AM
I have Two Tables
Table1 have the Following Field
Employee Name
EmployeeID
Table2 have the following Fields
Requestedby
Approved by
I want to get the name of Requestedby and Approved by by join query How to do
Robbe Morris replied to Gunasundari Loganathan on 13-Mar-13 08:43 AM
select a.ColumnA, a.ColumnB, b.ColumnA as ColumnC, b.ColumnB as ColumnC
from tableA a
LEFT JOIN tableB b on a.SomeKey = b.SomeKey
where a.ColumnD = some condition
and b.ColumnE = some other condition
malar malar replied to Gunasundari Loganathan on 13-Mar-13 11:31 AM
What is the common field in both the tables??
Select a.employeename,
a.employeeid,
b.requestedby,
b.approvedby
from table1 a inner join table2 b on a.(commonfield)=b.(commonfield)