Sample Header Ad - 728x90

Select using multiple lists from top to bottom

0 votes
2 answers
918 views
I need to select a value (Id) from a table based on matching items in 2 lists. Example.
-none
List 1 = ('Tony','Adam','Mark')
List 2 = ('Everton', 'Arsenal', 'Villa')
Table
-none
Id,Number, Name, Team
1, 100, Mark, Villa
2  110, Tony, Everton
3  120, Adam, Arsenal
Let's say that a query was done to pull only the name and team. I need take the results and get the number. But I need a query using the lists from top to bottom so first items on List A AND List B, then the 2nd, 3rd and so forth. I need both Name and Team to match in the same row. I hope I've explained that clearly.
Select Number, Name, Team
where Name = (list A) and Team = (list B).
---
Select Number from Teams
 where name = 'Tony' and team = 'Everton'
would give 110 but I need to do it on multiple values in one go.
Asked by Mogsy Mo (11 rep)
Apr 5, 2023, 05:42 PM
Last activity: Nov 8, 2024, 11:00 AM