Results 1 to 2 of 2
  1. #1
    TinaCa is offline Advanced Beginner
    Windows Vista Access 2010 32bit
    Join Date
    Jul 2011
    Posts
    87

    Join on three table not returning all records

    ...and it's returning duplicates. I need to see the amount to pay the worker every two weeks. So I need the total the worker is paid for an account (company table), the sum of any extras the worker did - like carpet cleaning (Extras Table) and the workers name and the workers company name (Crew Table). It should return 46 records when all is summed (i.e. 46 workers). I am getting 31 and 8 of the records show up 2 or more times.

    here is the querie in SQL
    SELECT CrewInformation.CrewMemberId, CrewInformation.CrewSupervisorName, CrewInformation.CrewCompanyName, Sum(CompanyInformation.CrewMemberAmount) AS SumOfCrewMemberAmount, Sum(tblCompanyExtras.ExtraWorkerAmt) AS SumOfExtraWorkerAmt
    FROM (CrewInformation LEFT JOIN CompanyInformation ON CrewInformation.CrewMemberId = CompanyInformation.CompanyCrewMember) LEFT JOIN tblCompanyExtras ON CrewInformation.CrewMemberId = tblCompanyExtras.ExtraWorkId
    WHERE (((CompanyInformation.CompanyActive)=True) AND ((CrewInformation.CrewMemberActive)=True) AND ((DatePart("d",[extradate]))>=1 And (DatePart("d",[extradate]))<=15) AND ((Format([extradate],"mm/yyyy")) Like "07/2011"))
    GROUP BY CrewInformation.CrewMemberId, CrewInformation.CrewSupervisorName, CrewInformation.CrewCompanyName, tblCompanyExtras.ExtraDate;

    I've tried splitting this into two tables and not summing - thinking i could do it in the report. Those solutions aren't working.

  2. #2
    TinaCa is offline Advanced Beginner
    Windows Vista Access 2010 32bit
    Join Date
    Jul 2011
    Posts
    87
    as a last result i went to a third query. Not pretty but it works.

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

Similar Threads

  1. Recordset not returning records
    By TinaCa in forum Programming
    Replies: 3
    Last Post: 08-03-2011, 09:26 AM
  2. Replies: 3
    Last Post: 02-02-2011, 01:00 PM
  3. Returning multiple records Isn't what I need
    By frobro390 in forum Queries
    Replies: 6
    Last Post: 09-21-2010, 06:24 PM
  4. Combo box returning only about 1000 records
    By cjbuechler in forum Forms
    Replies: 12
    Last Post: 06-30-2010, 08:27 AM
  5. Returning correct rows in a join/nested query
    By goneaccessing in forum Queries
    Replies: 5
    Last Post: 03-03-2010, 12:21 PM

Tags for this Thread

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