Free Lessons
Courses
Seminars
TechHelp
Fast Tips
Templates
Topic Index
Forum
ABCD
 
Home   Courses   TechHelp   Forums   Help   Contact   Merch   Join   Order   Logon  
 
Back to Access Forum    Comments List
Upload Images   @Reply   Bookmark    Link   Email   Next Unseen 
Join Queries
jannette j 
    
7 years ago
i have two queries I want to join so i can get the percentages from each department of completed work orders but not sure how to go about it. I know i want a join and a crosstab query so i can display the results  in a report.
The first query  calculates the numerator,

SELECT Count(MaximoReport.WorkOrder) AS CountOfWorkOrder, MaximoReport.[Assigned Owner Group]
FROM MaximoReport
WHERE (((MaximoReport.WorkType) In ("PMINS","PMOR","PMPDM","PMREG","PMRT")) AND ((MaximoReport.Status) Like "*COMP")
AND ((MaximoReport.[Target Start])>=DateAdd("h",-1,[Enter the start date])
And (MaximoReport.[Target Start])"00:00")
AND ((MaximoReport.ActualStartDate)>=DateAdd("h",-11.8,[Enter the start date])
And (MaximoReport.ActualStartDate)GROUP BY MaximoReport.[Assigned Owner Group];


while the second query calculates the denominator:

SELECT Count(MaximoReport.WorkOrder) AS CountOfWorkOrder, MaximoReport.[Assigned Owner Group]
FROM MaximoReport
WHERE (((MaximoReport.WorkType)
In ("PMINS","PMOR","PMPDM","PMREG","PMRT"))
AND ((MaximoReport.Status)<>"CAN")
AND ((MaximoReport.[Target Start])>=DateAdd("h",-11.8,[Enter the start date])
And (MaximoReport.[Target Start])GROUP BY MaximoReport.[Assigned Owner Group];


please advise how i cann join the two queries to get the percentages of the departments and then do a crosstab query.
If there a better way of doing this please also let me know.

Thought of running the query this way but I get errors.

SELECT SUM(iif((MaximoReport.Status Like "*COMP"),iif((MaximoReport.ActualLaborHours<>"00:00"),1,0),0)) AS CountCompleted,
SUM(iif((MaximoReport.Status) <> "CAN",1,0)) AS CountTotal,
Round([CountCompleted]/[CountTotal]*100,1) AS PercentCompleted
MaximoReport.[Assigned Owner Group]
FROM MaximoReport
WHERE (((MaximoReport.WorkType) In ("PMINS","PMOR","PMPDM","PMREG","PMRT"))
AND ((MaximoReport.[Target Start])>=DateAdd("h",-1,[Enter the start date])
AND (MaximoReport.[Target Start])AND ((MaximoReport.ActualStartDate)>=DateAdd("h",-11.8,[Enter the start date])
AND (MaximoReport.ActualStartDate)GROUP BY MaximoReport.[Assigned Owner Group];



Reply from Alex Hedley:

UNION Queries can join two datasets.

This thread is now CLOSED. If you wish to comment, start a NEW discussion in Access Forum.
 

Next Unseen

 
New Feature: Comment Live View
 
 

The following is a paid advertisement
Computer Learning Zone is not responsible for any content shown or offers made by these ads.
 

Learn
 
Access - index
Excel - index
Word - index
Windows - index
PowerPoint - index
Photoshop - index
Visual Basic - index
ASP - index
Seminars
More...
Customers
 
Login
My Account
My Courses
Lost Password
Memberships
Student Databases
Change Email
Info
 
Latest News
New Releases
User Forums
Topic Glossary
Tips & Tricks
Search The Site
Code Vault
Collapse Menus
Help
 
Customer Support
Web Site Tour
FAQs
TechHelp
Consulting Services
About
 
Background
Testimonials
Jobs
Affiliate Program
Richard Rost
Free Lessons
Mailing List
PCResale.NET
Order
 
Video Tutorials
Handbooks
Memberships
Learning Connection
Idiot's Guide to Excel
Volume Discounts
Payment Info
Shipping
Terms of Sale
Contact
 
Contact Info
Support Policy
Mailing Address
Phone Number
Fax Number
Course Survey
Email Richard
[email protected]
Blog RSS Feed    YouTube Channel

LinkedIn
Copyright 2026 by Computer Learning Zone, Amicron, and Richard Rost. All Rights Reserved. Current Time: 5/9/2026 6:58:39 AM. PLT: 1s