| ID| Country | State |
| 1 | America | New Jersey|
| 2 | America | New York |
| 3 | America | Seattle |
| 4 | Italy | Rome |
| 5 | Italy | Venice |
Another table has, for example, the name of a friend:
| ID| Friend | State |
| 1 | Bob | Rome |
| 2 | Joe | New York |
| 3 | Max | New York |
| 4 | Sam | New York |
| 5 | Hal | Venice |
One type of link that the user follow looks like this:
http://www.abcdefghi.com/index.php?Country=%&State=New%20Jersey
Then, I build a query that finds all the friends in New Jersey. But, as you can see from sample table, there are no friends in New Jersey. So instead, I want to display all the friends in America.
How do I build a query that will first look in "Country Table" and see what country New Jersey is in, and then, write another query based on that information that will find all the friends from that country as they are listed in "Friend Table"?
I try to read joins, but cannot tell if it will work.
Please help me, thank you very much.