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 |
|
whitebird
Starting Member
12 Posts |
Posted - 2008-03-12 : 05:54:08
|
| hi, i have a table like this. employees emp_id, emp_name , emp_active, emp_departPID, emp_salary 1 'robert' 1 1 200 2 'Rose' 0 1 100 Department DepartmentPID, DepartmentName 1 softwarei need an sql query like. i want to inner join employee table with department table when emp_derpatmentPID IS 1 can you help me out please.Raghu sunkara. |
|
|
harsh_athalye
Master Smack Fu Yak Hacker
5581 Posts |
Posted - 2008-03-12 : 06:08:35
|
| Sure, why not.You have requiremnent clear in your mind. Now go step by step to achieve the solution desired.1. I want to inner join employee table with department table This is syntax for joining two tables:From <table1> JOIN <table2> ON <condition>Here, condition will be equality condition to match DepartmentPID and emp_departPID columns.2. when emp_derpatmentPID IS 1 Just convert this to WHERE condition3. Now add those two pieces with a SELECT clause to fetch required columns and you're done.Harsh AthalyeIndia."The IMPOSSIBLE is often UNTRIED" |
 |
|
|
|
|
|