SOQL only supports clauses where a field is compared to a literal value. For example, you can't say "where 1", because no field is referenced, nor can you say "where fieldA = fieldB", as no literal is provided. In objects that support custom fields, you can make a formula, such as "fieldA = fieldB", then perform a query in the custom field, such as "where fieldC = TRUE". However, team members can't have custom fields for now, so there's no way to get this in a standard query. External reporting tools, such as Crystal Reports, as well as traditional databases, such as MySQL, can query this data. Typically, this means exporting the contents of both tables into CSV files, importing them into the external system, then querying. Crystal Reports handles all the steps at once, for example, but it's not a cheap application.
Alternatively, you can query this data into a browser and process the results client side, or in Visualforce controller code server side.