This has been asked and answered in different instances but all that I've seen doesn't quite work for my problem.
PROBLEM: I have 3 tables I need to pull data from at the same time to compare and retrieve information from. All 3 tables contain an 'email' column. Now, a user's email from table1 may match same user's email in both table2 AND table3, depending on user's status. OR an email from table1 will ONLY match either an email in table2 or table3, depending on user's status again. For example, a user may have a red status (user will show in table2), a blue status (user will show in table3), or both, red and blue (user will show in both, table2 and table3).
WHAT IS NEEDED: an email from table1 needs to be compared to email in table2 and table3 and return a region value for a given user, which is recorded in table2 and table3 but not in table1. I know. Delightful data architecture! Either way, I was able to JOIN table1 to table2 very successfully but I am not sure how to slap on a JOIN with table3.
Here's the query for 2 tables:
SELECT * FROM table1 INNER JOIN table2 ON table2.email = table1.email WHERE month = 'numberHere' ORDER BY submitdate DESC When I simply add another INNER JOIN my code doesn't break per say but it doesn't give me any rows to be displayed either. So the code below doesn't work despite the many working examples from the web:
SELECT * FROM table1 INNER JOIN table2 ON table2.email = table1.email INNER JOIN table3 ON table3.email = table2.email WHERE month = 'numberHere' ORDER BY submitdate DESC