Greetings, fellow SO people.
I am working on a project that has me working with an Access database. Here's the setup:
I have three tables:
Tab1 with employee names, ID#s, Manager names and Manager ID#s.
Tab2 with chat info, employee ID#s and employee names.
Tab3 with Manager ID#s, Manager names and team names.
I currently have a query that selects the following:
tab2.[employee name], tab2.[employee id], tab3.[chat info], tab1.[manager id], tab1.[manager id], tab3.[team name]
where
tab2.[employee id] = tab1.[employee id] and tab2.[manager id] = tab3.[manager id];
What I am trying to accomplish is this: I would like to have a way to put "Unknown" in the "Team" field if the IDs don't match up somewhere along the line. Any ideas?
Thanks in advance!
Perhaps something like:
select tab2.[employee name],
tab2.[employee id],
tab3.[chat info],
tab1.[manager id],
Nz(tab3.[team name], 'Unknown') as [team name]
from (tab2
left join tab1
on tab2.[employee id] = tab1.[employee id])
left join tab3
on tab2.[manager id] = tab3.[manager id]
SELECT
tab2.[employee name], tab2.[employee id],
tab3.[chat info], tab1.[manager id],
tab1.[manager id],
Nz(tab3.[team name],"Unknown")
FROM (tab2
LEFT JOIN tab1
ON tab2.[employee id] = tab1.[employee id])
LEFT JOIN tab3
ON tab2.[manager id] = tab3.[manager id];
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With