Get consolidated data by joining two queries in to one

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • sureshdurai1
    New Member
    • Feb 2012
    • 2

    Get consolidated data by joining two queries in to one

    I have two queries which are containing one with sales data which is grouped is grouped by month, employee name, product name and sum of Sales Amount and secound query which is grouped by Month, Employee Name, product name and the assigned target.

    Below is the [Sales Query] SQL view.
    Code:
    SELECT [Master Sales Query].[Branch Sales Name], [Master Sales Query].Month, [Master Sales Query].[Product Name], Sum(Nz([Net Sales],0)) AS Sales
    FROM [Master Sales Query]
    GROUP BY [Master Sales Query].[Branch Sales Name], [Master Sales Query].Month, [Master Sales Query].[Product Name]
    ORDER BY [Master Sales Query].[Branch Sales Name], [Master Sales Query].Month;
    [Employees Target Query] SQL View
    Code:
    SELECT [pEmployees Target].[Branch Sales Name], Month([TargetDate]) AS [Month], [pEmployees Target].[Product Name], Sum(NZ([Target],0)) AS [Target YTM]
    FROM [pEmployees Target]
    GROUP BY [pEmployees Target].[Branch Sales Name], Month([TargetDate]), [pEmployees Target].[Product Name], [pEmployees Target].TargetDate;
    Now I need to compare the each employees sales vs their assigned target with % of the acchivement in a pivot table.

    Please any one could help me out?
    Last edited by NeoPa; Feb 24 '12, 12:28 AM. Reason: Added mandatory [CODE] tags for you
  • Rabbit
    Recognized Expert MVP
    • Jan 2007
    • 12517

    #2
    You could join the queries to each other on your key fields.

    Comment

    • sureshdurai1
      New Member
      • Feb 2012
      • 2

      #3
      Thank You

      Thanking you so much for the immediate & helpful answer. My problem has been solved now.

      Comment

      Working...