Results 1 to 2 of 2
  1. #1
    willy292 is offline Novice
    Windows XP Access 2007
    Join Date
    Jul 2013
    Posts
    4

    Join query Problem

    Thanks wholeheartedly for everyone who try to solve my problems
    I have two query called query1 and query3 having the following
    structure

    Query1
    Project Name, Project desc, start Date,end
    date,sponsor, TeamA, TeamB, Team C

    The value of TeamA,TeamB,TeamC is -1
    or 0 which is orignally the Yes/No boxes from table , A project can be catered
    by more than 1 team together which means TeamA and TeamB or even TeamC can be -1
    on the same row.
    This query show the outstanding
    project.

    Query3


    Project Name, Working
    hr,Date,TeamA,TeamB,TeamC

    This query show the working hr within weeks in
    each team, only One team
    can be allocated for each record, TeamA,TeamB,TeamC
    is Yes/No box.
    Not all the outstanding projects appear in query 3 because
    some project may be pending.

    Aim
    Return for each project, how many working hours have been spent for each team

  2. #2
    June7's Avatar
    June7 is online now VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,632
    Data is not normalized structure so this will be tricky. Try:

    SELECT [Project Name], Sum(IIf(TeamA, [Working Hr], 0)) AS TeamAHrs, Sum(IIf(TeamB, [Working Hr], 0)) AS TeamBHrs, Sum(IIf(TeamC, [Working Hr], 0)) AS TeamCHrs FROM Query3 GROUP BY [Project Name];
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

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

Similar Threads

  1. Left join problem
    By e.badin in forum Queries
    Replies: 5
    Last Post: 01-17-2011, 08:03 AM
  2. Problem with Join
    By sujitshukla in forum Queries
    Replies: 1
    Last Post: 08-26-2010, 07:25 AM
  3. Many to many self-join problem
    By dbdbdo in forum Database Design
    Replies: 1
    Last Post: 07-18-2010, 09:31 AM
  4. Problem with Left Join & VB6
    By msrdjan1 in forum Queries
    Replies: 0
    Last Post: 03-30-2010, 01:48 AM
  5. Dynamic Query Outer Join Problem
    By mjack003 in forum Queries
    Replies: 0
    Last Post: 07-21-2006, 01:07 PM

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