Results 1 to 5 of 5
  1. #1
    camell is offline Novice
    Windows XP Access 2007
    Join Date
    Mar 2011
    Posts
    3

    combining two queries


    alright i can admit it, I'm not that good at this. I'm trying to make a report that will in the end show how many cabs a company has, how many cabs have not been inspected and the percentage of their fleet done or not done. I have made separate queries showing the total cabs by Co. and one showing totals of cabs not inspected. I can not make one query showing both of the totals correctly together. any help would be great

  2. #2
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,521
    Are you a competitor of ours or a regulator? I need to know whether to be nice or not.

    If the inspection field is Null when there's no inspection, this should work:

    SELECT Count(*) AS CountOfCars, Count(InspectionField) AS Inspections, Format(Count(InspectionField)/Count(*), "Percent") as PercentageDone
    FROM TableName
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  3. #3
    camell is offline Novice
    Windows XP Access 2007
    Join Date
    Mar 2011
    Posts
    3
    Quote Originally Posted by pbaldy View Post
    Are you a competitor of ours or a regulator? I need to know whether to be nice or not.
    which one are you going to be nice too?

    if I understand it right, it looks like you are pulling the info from one table.
    i have a table for vehicle inventory and a table for VDR issused which has a field for inspection among others and yes not inspected is null

  4. #4
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,521
    I was only kidding; I'm nice to everybody. It should still be doable, but with a join on the two tables. Can you post a sample db we can play with?
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  5. #5
    camell is offline Novice
    Windows XP Access 2007
    Join Date
    Mar 2011
    Posts
    3
    I was able to finally show both cabs in service and not inspected on the same list with out the extra info, by adding the join now all i have to do is figure out the percentage column.

    SELECT [4) Cabs in service totals].lkpCabCo AS [Cab Co], [4) Cabs in service totals].CountOfstrVIN AS [Cabs in service], [4) cabs not inspected totals].CountOfstrCabNumber AS [Cabs not inspected]
    FROM [4) Cabs in service totals] INNER JOIN [4) cabs not inspected totals] ON [4) Cabs in service totals].lkpCabCo = [4) cabs not inspected totals].lkpCabCo;


    it aint pretty right now but it works so far

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

Similar Threads

  1. Combining crosstab Queries
    By Garito100 in forum Queries
    Replies: 0
    Last Post: 10-22-2010, 02:26 AM
  2. Combining queries
    By wildlifeaccess in forum Queries
    Replies: 10
    Last Post: 09-20-2010, 07:35 AM
  3. Combining Two Queries
    By csolomon in forum Queries
    Replies: 1
    Last Post: 09-03-2009, 01:33 PM
  4. Replies: 0
    Last Post: 03-31-2009, 02:05 AM
  5. Combining like update queries
    By xcr800man in forum Queries
    Replies: 2
    Last Post: 05-20-2008, 08:36 AM

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