I am trying to make my SQL query do this:
sql Code:
SELECT * FROM b INNER JOIN a ON b.aa = a.aa WHERE b.id = (SELECT choice1 FROM a INNER JOIN ListSelection ON ListSelection.num =a.num WHERE ListSelection.TABLE = 'Level' AND ListSelection.SaveNumber = 123) AND b.id = (SELECT choice2 FROM a INNER JOIN ListSelection ON ListSelection.num = a.num WHERE ListSelection.TABLE = 'Level' AND ListSelection.SaveNumber = 123) AND b.id = (SELECT choice3 FROM a INNER JOIN ListSelection ON ListSelection.num = a.num WHERE ListSelection.TABLE = 'Level' AND ListSelection.SaveNumber = 123) AND b.id = (SELECT choice4 FROM a INNER JOIN ListSelection ON ListSelection.num = a.num WHERE ListSelection.TABLE = 'Level' AND ListSelection.SaveNumber = 123)
This is trying to accplish the following.
A table that has four choices that all refer to numbers from one field in another table.
List B is selecting within the constraints of what was selected in List A. The results display all the FOUR choices (found in the corresponding records) for each of the items from List A. The selections from List A were saved to a table called ListSelection. List A was limited by the selections made and saved to a table called Level which represents the first List that was chosen. So lists in order: List Level > ListA > ListB