I inherited an Access 2003 database with this setup:
TableOne
TableOneId pocOne pocTwo
1 2 3
2 2 4
3 1 2
TableTwo
TableTwoId Name
1 Jones
2 Smith
3 Edwards
4 Camden
I currently have this query where I need to find all the records that
match the criteria (Smith) and was wondering how I can eliminate the
Union All and put it in one SQL:
select * from TableTwo
Inner Join TableOne
on TableTwo.TableT woId = TableOne.pocOne
where Name = 'Smith'
UNION ALL
select * from TableTwo
Inner Join TableOne
on TableTwo.TableT woId = TableOne.pocTwo
where Name = 'Smith'
TableOne
TableOneId pocOne pocTwo
1 2 3
2 2 4
3 1 2
TableTwo
TableTwoId Name
1 Jones
2 Smith
3 Edwards
4 Camden
I currently have this query where I need to find all the records that
match the criteria (Smith) and was wondering how I can eliminate the
Union All and put it in one SQL:
select * from TableTwo
Inner Join TableOne
on TableTwo.TableT woId = TableOne.pocOne
where Name = 'Smith'
UNION ALL
select * from TableTwo
Inner Join TableOne
on TableTwo.TableT woId = TableOne.pocTwo
where Name = 'Smith'
Comment