query sort by week

AccidentalFate

Registered User.
Local time
Yesterday, 19:30
Joined
Apr 28, 2008
Messages
42
i have a query i am working on that is sorted, sumed and grouped... i have it grouped by 4 fields (date, class, rate, shift) with one sumed field (hours). it doesn't group and sum the data correctly.

here is the SQL

Code:
SELECT EnterJobLabor.Classification, EnterJobLabor.Rate, EnterJobLabor.Shift, Sum(EnterJobLabor.HoursWorked) AS SumOfHoursWorked, EnterJobLabor.DateWorked
FROM EnterJobLabor
GROUP BY EnterJobLabor.Classification, EnterJobLabor.Rate, EnterJobLabor.Shift, EnterJobLabor.DateWorked
HAVING (((EnterJobLabor.DateWorked)=([dateworked]-Weekday([dateworked])+7)))
ORDER BY EnterJobLabor.DateWorked;

is there a max on the groups? or is there something else wrong?

and ideas on help...

hours.jpg
 
Last edited:
What does the query look like?
 
i showed a picture.. does it work?
 
The picture is of the result of the query.
What does the query itself look like (i.e the SQL)?
 
shift should be a 1 or a 2 - that works
class is jw,ad,pm,op,ef... etc. - that works
rate should be 1, 1.5 or 2 - doesn't work
 
Oh... here

SELECT EnterJobLabor.Classification, EnterJobLabor.Rate, EnterJobLabor.Shift, Sum(EnterJobLabor.HoursWorked) AS SumOfHoursWorked, EnterJobLabor.DateWorked
FROM EnterJobLabor
GROUP BY EnterJobLabor.Classification, EnterJobLabor.Rate, EnterJobLabor.Shift, EnterJobLabor.DateWorked
HAVING (((EnterJobLabor.DateWorked)=([dateworked]-Weekday([dateworked])+7)))
ORDER BY EnterJobLabor.DateWorked;

directly from the sql
 
The query looks fine to me. I think it just gives the impression of not grouping as the values match. Each of the records seems to be different, taking into account the combination of Class, Shift and Date, so the Rate has no effect.
 
i thought it looked oka...

but i know for a fact that there should be a rate of 1 for each week just like there is a 1.5 but the 1 isn't showing....
 
If you just run
Code:
SELECT EnterJobLabor.Classification, EnterJobLabor.Rate
FROM EnterJobLabor
GROUP BY EnterJobLabor.Classification, EnterJobLabor.Rate;
Does it give you the expected values?
 
How about
Code:
SELECT EnterJobLabor.Rate
FROM EnterJobLabor
GROUP BY EnterJobLabor.Rate;
If that one doesn't work, perhaps the data in the table isn't as it should be?
 
SELECT EnterJobLabor.Rate, Sum(EnterJobLabor.HoursWorked) AS SumOfHoursWorked, EnterJobLabor.DateWorked
FROM EnterJobLabor
GROUP BY EnterJobLabor.Rate, EnterJobLabor.DateWorked
HAVING (((EnterJobLabor.DateWorked)=([dateworked]-Weekday([dateworked])+7)))
ORDER BY EnterJobLabor.DateWorked;


i tried this too and it still wont show the rate 1
 
So this doesn't show any Rate values of '1'
Code:
SELECT EnterJobLabor.Classification, EnterJobLabor.Rate
FROM EnterJobLabor
GROUP BY EnterJobLabor.Classification, EnterJobLabor.Rate;
but this does?
Code:
SELECT EnterJobLabor.Rate
FROM EnterJobLabor
GROUP BY EnterJobLabor.Rate;
I'm afraid I'm stumped :confused:

I'll carry on having a think about it today, but I have a few meetings to attend, so hopefully someone else will step in with a suggestion.
 
i dono if this will work... never done it...

http://www.filejumbo.com/Download/B22077746FA736CA - i forgot to show the database window so you will need to download... make a new database and import the table and query

but what i did was made another database with just the information needed... see if this helps you in trying to figure it out... i'm stumped too...
 
Last edited:
from looking more into it... it also doesn't add correctly or show all the fields...
 

Users who are viewing this thread

Back
Top Bottom