MsLady
Traumatized by Access
- Local time
- Today, 14:12
- Joined
- Jun 14, 2004
- Messages
- 438
I have a three tables:
Employee table (empId, firstname, lastname)
Positions table (positionId, title)--{lists positions}
EmpPositions table (empId, empPositionId, positionId)
Not all employee have positions (i.e. not all employees have records in the empPositions table).
Some employee's position have been archived (archived=1).
I'd like run a query that -->select firstname, lastname, title
1. If an employee does not have a record in the empPositions table, i'd like the title to read "-no active position").
2. If an employee's position have been archived (archived =1), i'd also like the title to read "-no active position").
3. If the employee's has a position, then display the title.
-->select firstname, lastname, title
I have written the query but something is missing and i'd like to start over, as the people with archived position don't show up.
So, how would you write this?
I am using sql server 2000 (t-sql. stored procedure)
Employee table (empId, firstname, lastname)
Positions table (positionId, title)--{lists positions}
EmpPositions table (empId, empPositionId, positionId)
Not all employee have positions (i.e. not all employees have records in the empPositions table).
Some employee's position have been archived (archived=1).
I'd like run a query that -->select firstname, lastname, title
1. If an employee does not have a record in the empPositions table, i'd like the title to read "-no active position").
2. If an employee's position have been archived (archived =1), i'd also like the title to read "-no active position").
3. If the employee's has a position, then display the title.
-->select firstname, lastname, title
I have written the query but something is missing and i'd like to start over, as the people with archived position don't show up.
So, how would you write this?
I am using sql server 2000 (t-sql. stored procedure)