|table1| -------- |id | Primary |rid | |table2| -------- |rid | primary table1 has a primary key table1 also has a table2 (matched by rid) We are wanting to get all table1 entries that match a given table2 (using rid not id)