Hello everyone,
Sorry - I've recently submitted the same question but was away for a week and never had a chance to reply to the original thread. This is my script:
SELECT tv.pm_name, tv.tech_name, empl.f_name, empl.l_name,
empl.address, empl.phone, empl.fax
FROM task_view tv, employee empl, role rol
WHERE tv.emp_id = empl.ind_id
AND empl.ind_id = rol.role_id
AND empl.archive = 'N'
AND rol.role_code = 'DR';
This is what it's returning:
PM_NAME TECH_NAME F_NAME L_NAME ADDRESS PHONE FAX
Jack Do Amy Jones Amy Jones Burke Ct 888-8888 889-0098 Jack Do Amy Jones Jack Do Fair Ln 876-9888 766-8999 Jack Do Amy Jones Sam Jim Main St 875-8767 763-8787
Basically Jack Do is a PM, Amy Jones is a tech lead, and Sam Jim is a director the the contract above. I want to write a select so that it will only return the f_name, l_name, address, phone, and fax for the director if there is one for the contract. Istead of the multiple rows above, I would only like to display one row like below:
PM_NAME TECH_NAME F_NAME L_NAME ADDRESS PHONE FAX
Jack Do Amy Jones Sam Jim Main St 875-8767 763-8787
The contracts will always have a pm and a tech lead but not necessarily a director. If the contract doesn't have a director (DR), then the f_name, l_name, address, phone and fax will just be blank.
Please let me know if you don't understand what I'm trying to do.
I'm thinking there needs to be a self-join for the select.
Can someone please help?
Thanks in advance,
sql99
Sorry - I've recently submitted the same question but was away for a week and never had a chance to reply to the original thread. This is my script:
SELECT tv.pm_name, tv.tech_name, empl.f_name, empl.l_name,
empl.address, empl.phone, empl.fax
FROM task_view tv, employee empl, role rol
WHERE tv.emp_id = empl.ind_id
AND empl.ind_id = rol.role_id
AND empl.archive = 'N'
AND rol.role_code = 'DR';
This is what it's returning:
PM_NAME TECH_NAME F_NAME L_NAME ADDRESS PHONE FAX
Jack Do Amy Jones Amy Jones Burke Ct 888-8888 889-0098 Jack Do Amy Jones Jack Do Fair Ln 876-9888 766-8999 Jack Do Amy Jones Sam Jim Main St 875-8767 763-8787
Basically Jack Do is a PM, Amy Jones is a tech lead, and Sam Jim is a director the the contract above. I want to write a select so that it will only return the f_name, l_name, address, phone, and fax for the director if there is one for the contract. Istead of the multiple rows above, I would only like to display one row like below:
PM_NAME TECH_NAME F_NAME L_NAME ADDRESS PHONE FAX
Jack Do Amy Jones Sam Jim Main St 875-8767 763-8787
The contracts will always have a pm and a tech lead but not necessarily a director. If the contract doesn't have a director (DR), then the f_name, l_name, address, phone and fax will just be blank.
Please let me know if you don't understand what I'm trying to do.
I'm thinking there needs to be a self-join for the select.
Can someone please help?
Thanks in advance,
sql99