Results 1 to 2 of 2

Thread: merge queries

  1. #1
    Join Date
    Mar 2002
    Covington, LA

    Question Unanswered: merge queries

    i have two queries i need to merge together. when i preview qrySales_By_Site_Billed, it shows the SiteID, Month it was billed, and the Sum of the amount billed that month. i also have qrySales_By_Site_Recieved, that shows SiteID, Month it was Recieved, and the Sum of the amount recieved. what i would like to do is merge them together into a query so it'll show SiteID, Month, Billed, and Recieved.

    in the end, i need to be able to print a report that has a column for SiteID, and then a column for each of the 12 months(i'll probley only be able to fit 6 months to a page), and then i would like to have 2 sub-columns (i know they dont exist, but do you know what i mean?) under each month. one for Billed and one for Recieved. This way we can look down the list for a site and find what we billed and recieved from them for each month. then at the end we could have totals for billed and recieved from site over the year, and then billed and recieved monthly total.

    If somone could help me merge the 2 queries so that I'd have the site, month, billed, and recieved to work with, i could struggle on a lil farther, maybe even finish it.

    thanks for reading. sorry if i was'nt to clear.
    Unique like everyone else,

  2. #2
    Join Date
    Apr 2002
    I'm not 100% sure what you mean but:

    SELECT qrySales_By_Site_Billed.SiteID, qrySales_By_Site_Billed.Month_Billed, qrySales_By_Site_Billed.[Sum of Amount_Billed], qrySales_By_Site_Recieved.Month_Recieved, qrySales_By_Site_Recieved.[Sum of Amount_Recieved]
    FROM qrySales_By_Site_Billed INNER JOIN qrySales_By_Site_Recieved
    ON qrySales_By_Site_Billed.SiteID = qrySales_By_Site_Recieved.SiteID;

    joins the 2 queries with the SiteID (only selecting Sites billed and recieved otherwise you'll have to use a RIGHT JOIN or LEFT JOIN)
    Of course you'll need to change the fieldnames to whatever you have.

    Hope this helps...

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts