mapping query help

  • I need anyones help quering some tables. I have a report process that runs and emails users report files.

    I need a datatable of the files with the emails that they will be sent to.

    There are 3 tables:

    1) Files (id, filename)

    2) Email_Lookup (id, emailaddress)

    3) Mapping (Files.id, and Email_Lookup.id)

    Thanks in advance for help

    Ryan

  • When i first read this i was confused as to whether you were asking for the table design/schema, or the sql to get the data;

    Assuming you already have the 3 tables you mention above, this is a prototype of the sql; it would have been more accurate if you posted the actual schema or table/columnnames involved:

    SELECT FILES.FILENAME,EMAILLOOKUP.EMAILADDRESS

    FROM MAPPING

    INNER JOIN FILES ON FILES.ID=MAPPING.FILESID

    INNER JOIN EMAIL_LOOKUP ON EMAIL_LOOKUP.ID=MAPPING.EMAILLOOKUPID

    Lowell


    --help us help you! If you post a question, make sure you include a CREATE TABLE... statement and INSERT INTO... statement into that table to give the volunteers here representative data. with your description of the problem, we can provide a tested, verifiable solution to your question! asking the question the right way gets you a tested answer the fastest way possible!

Viewing 2 posts - 1 through 1 (of 1 total)

You must be logged in to reply to this topic. Login to reply