Results 1 to 3 of 3
  1. #1
    rickn is offline Novice
    Windows XP Access 2007
    Join Date
    Apr 2010
    Posts
    7

    JOIN Two Queries

    I have these two queries that work fine and need to combine the second query to the first query if the PODetail.PartNumber = WOShortages.PartNumber.

    FIRST QUERY:
    SELECT WOShortages.WONumber, WOShortages.PartNumber, WOShortages.TransactionDate, WOShortages.Quantity, WOShortages.UOM, L.NettableQuantity, P.DescText AS PartDescription
    FROM (WOShortages LEFT JOIN PartMaster AS P ON WOShortages.PartNumber = P.PartNumber) LEFT JOIN (SELECT L.PartNumber,
    SUM(L.Quantity) AS NettableQuantity
    FROM InventoryLots L
    LEFT JOIN DepartmentCodes D ON L.DepartmentCode = D.DepartmentCode
    WHERE D.NettableFlag<>0
    GROUP BY L.PartNumber ) AS L ON WOShortages.PartNumber = L.PartNumber


    ORDER BY WOShortages.WONumber, WOShortages.PartNumber, WOShortages.UOM;

    SECOND QUERY:
    SELECT POD.PartNumber, Sum(([POD]![QuantityReceived]-[POD]![QuantityOrdered]*-1)) AS QtyRemaining
    FROM POHeader AS POH INNER JOIN PODetail AS POD ON POH.PONumber = POD.PONumber
    GROUP BY POD.PartNumber, POH.ClosedFlag
    HAVING (((Sum(([POD]![QuantityReceived]-[POD]![QuantityOrdered]*-1)))>0) AND ((POH.ClosedFlag)=0));

  2. #2
    pdebaets is offline Competent Performer
    Windows Vista Access 2010 (version 14.0)
    Join Date
    Jul 2010
    Location
    Los Angeles
    Posts
    235
    select FirstQuery.*, SecondQuery.* from FirstQuery, SecondQuery where FirstQuery.partnumber = SecondQuery.partnumber;

  3. #3
    rickn is offline Novice
    Windows XP Access 2007
    Join Date
    Apr 2010
    Posts
    7

    JOIN Two Queries

    Actually, I'm not combining the two queries but combining the two Select Queries.

Please reply to this thread with any new information or opinions.

Similar Threads

  1. Join Query?
    By KWarzala in forum Forms
    Replies: 5
    Last Post: 07-29-2014, 02:44 PM
  2. Join queries that do not have matching field
    By Petefured in forum Queries
    Replies: 2
    Last Post: 05-04-2010, 11:19 AM
  3. inner join in query
    By Hrcko in forum Access
    Replies: 1
    Last Post: 02-01-2010, 05:54 PM
  4. SQL JOIN statement
    By seen in forum Access
    Replies: 10
    Last Post: 01-15-2010, 05:34 PM
  5. Self Join in a Table
    By LornaM in forum Database Design
    Replies: 10
    Last Post: 05-06-2009, 10:29 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums