Group by Problem

smashclash

Board Regular
Joined
Nov 24, 2003
Messages
126
Office Version
  1. 365
Platform
  1. Windows
I'm having trouble with a query for my payroll reports. The query has two tables. The first one is simply #'s: 0-29 each in a different row. These #'s represent a site aka an outside office. The second table has all of the payroll information in it. There are 3 columns. There is a column for the amount of pay, the type of pay it is (H-is used for hourly, S-is used for salary), and which site it should go to (0-29 are the site numbers.)

What I'm trying to do is create a query that lists every site in Column A, and the amount of pay for each site in Column B, except it should only show the payroll totals for "H" - hourly salary. There is a 2nd query that does the same thing except it pulls only the "S" - salary.

I thought this would be a simple task and setup my query. I put both tables in the query and linked them together by "include ALL records from site and only those where they are equal from data". (Site is the name of the site table, and data is the name of the table with all the payroll information.) In column 1 in the design mode of the query it is pulling the sites, in column 2 it is pulling the amount of pay and in column 3 it is pulling only the "H" - hourly type salary. The problem I run into when I do this is that the query is no longer including ALL the sites (all 0-29) rows. It now only shows data where there is amounts <>0. So for example, it shows totals for sites 0-8, skips 9-10, then shows 11-29. The amounts for 9-10 equal 0 but I still want to show them. When I remove the "group by "H"" feature the query works and shows all the sites. However it doesn't separate the Hourly from the Salary wages.

I've checked to make sure that both tables are set as #'s for the Sites linked from the site table and the Site linked from the Data table. For some reason the new group by for the "H" and "S" do not pull in all the sites.

Anyone know what I could do to get this to work? How do I get it to include all the sites again? There has to be a way I can have the query grouped by H or S and still show all the sites.
 
andrew93 said:
BTW, is this an "update" or an "aapend" query that you are trying to use? Now I'm getting confused ..... my test query was as a simple "select" query.
Andrew

i also used a select query and deleted all "extra" columns to no avail. :(
 
Upvote 0

Excel Facts

How can you automate Excel?
Press Alt+F11 from Windows Excel to open the Visual Basic for Applications (VBA) editor.
** you have more mail **

The select query doesn't work in conjunction with the isnull function where the table was full of data. You will see in the revised version of the database that I have taken a 2-step approach to get around this problem.

A. :)
 
Upvote 0

Forum statistics

Threads
1,221,819
Messages
6,162,155
Members
451,749
Latest member
zack_ken

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top