MYSQL Find data in one table based on one of two fields in another table -


complete noob question, apologies that.

i have 2 tables, members table email address , telephone number in , second table have email addresses , telephone numbers in many instances of members' telephone number or email address. want query second table , list results corresponding each member's email address or telephone number.

thanks much

here's rough query based on info supplied:

select members_table.*, joined_tables.*  members_table,  ((select * second_table   join members_table      on members_table.email_address = second_table.email_address) union /* or intersect if don't want dupes */ (select * second_table   join members_table      on members_table.telephone_number = second_table.telephone_number) ) joined_tables; 

at least should give idea on how go it.


Comments

Popular posts from this blog

ASP.NET/SQL find the element ID and update database -

jquery - appear modal windows bottom -

c++ - Compiling static TagLib 1.6.3 libraries for Windows -