Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
Author |
Topic |
Shadab Shah
Starting Member
23 Posts |
Posted - 2012-07-30 : 00:27:31
|
Suppose i have a table asEmployee (Empid,EmpName,DeptId,ManId)And then another table asDepartment (DeptId,DeptName,ManId)And now i want to perform the operation as (Employee - Department ) And the output i want is (EmpId,Empname,DeptName). |
|
khtan
In (Som, Ni, Yak)
17689 Posts |
Posted - 2012-07-30 : 00:34:06
|
you use INNER JOIN on column DeptIdSELECT e.EmpId, e.Empname, d.DeptNameFROM Employee e INNER JOIN Department d ON e.DeptId = d.DeptId KH[spoiler]Time is always against us[/spoiler] |
 |
|
Shadab Shah
Starting Member
23 Posts |
Posted - 2012-07-30 : 00:46:32
|
I dont want records. In the above example just to make reader understand my problem i had given a sample. In practical there may be 20-30 columns in my table. The output that i am expecting is just as EmpId EmpName DeptName (No records). |
 |
|
khtan
In (Som, Ni, Yak)
17689 Posts |
Posted - 2012-07-30 : 00:58:02
|
quote: Originally posted by Shadab Shah I dont want records. In the above example just to make reader understand my problem i had given a sample. In practical there may be 20-30 columns in my table. The output that i am expecting is just as EmpId EmpName DeptName (No records).
Can you illustrate with an example ? KH[spoiler]Time is always against us[/spoiler] |
 |
|
Shadab Shah
Starting Member
23 Posts |
Posted - 2012-07-30 : 01:29:07
|
Hi. The output which i am looking should look like EmpId EmpName DeptName. thats it. Nothing more. The query should eliminate empid and manid because they are common in both the table. |
 |
|
|
|
|
|
|