Results 1 to 2 of 2
  1. #1
    Join Date
    Mar 2003

    Unanswered: Joining 2 queries - union i think

    is it possible to join these two queries together, so that the 2nd query appears at the bottom of the first?

    SELECT OEEModelMCTotals.Machine, OEEModelMCTotals.EventCode, OEEModelMCTotals.CodeDescription, OEEModelMCTotals.SumOfTotalTime, OEEModelMCTotals.Occur, OEEModelMCTotals.PlannedTime, [OEEModelMCTotals]![SumOfTotalTime]/[OEEModelMCTotals]![PlannedTime] AS [%Schedule], [OEEModelMCTotals]![SumOfTotalTime]/[OEEModelMCTotals]![Occur] AS Avg, OEEModelMCTotals.Output, OEEModelMCTotals.Throughput, OEEModelMCTotals.ValueAddedime
    FROM OEEModelMCTotals
    WHERE (((OEEModelMCTotals.EventCode) Not Like "n204" And (OEEModelMCTotals.EventCode)<>"n301" And (OEEModelMCTotals.EventCode)<>"n303" And (OEEModelMCTotals.EventCode)<>"x104" And (OEEModelMCTotals.EventCode)<>"x117"));

    SELECT OEEModelOtherTotals.EventCode, OEEModelOtherTotals.CodeDescription, OEEModelOtherTotals.Machine, Sum(OEEModelOtherTotals.TotalTime) AS SumOfTotalTime, Sum(OEEModelOtherTotals.Occur) AS SumOfOccur
    FROM OEEModelOtherTotals
    GROUP BY OEEModelOtherTotals.EventCode, OEEModelOtherTotals.CodeDescription, OEEModelOtherTotals.Machine;

    i have attached a spreadsheet with the outcome i am after....i dont want it in excel but have used this for my demonstration.

    you will see at the bottom of the sheet i have highlighted the info added in blue.

    can this be achieved ?

    if so how please.


    Attached Files Attached Files

  2. #2
    Join Date
    Oct 2003
    Technically you can union any two queries as long as....

    The number of columns returned is the same in both queries.
    The datatypes of those columns is the same in both queries.


Posting Permissions

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