Query from two tables

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • emandel
    New Member
    • Dec 2006
    • 65

    Query from two tables

    I need to get information out of 2 tables and could use some help.
    Say i have 2 tables "staff" & "customers" they each have fields "first_name " "last_name" "e-mail"

    I would like to create a query that gives me a combined list of everyone's first name last name and e-mail. So that I can do a mail merge and send a common e-mail to everyone.

    (do I need to create a relationship amongst the tables first?)

    If you can give me the "regular" instructions rather than posting the vba code, it would be even more helpful.

    Thank you in advance
  • emandel
    New Member
    • Dec 2006
    • 65

    #2
    OK, i wasn't lazy and I did some more research. I got this:

    Code:
    SELECT [Last Name], [First Name], [e-mail]
    FROM [From Old List]
    WHERE [E-MAIL] is not null
    
    UNION SELECT [Last Name], [First name], [e-mail]
    FROM [participants]
    WHERE [E-MAIL] is not null
    ORDER BY [last name];
    but I really don't know much about sql,
    How do I add a line that will only give me DISTINCT records? What I want is that an e-mail should only be shown once even if it is assigned on each table to the same [las name], [first name] or even if it is to differant people?

    Comment

    Working...