|
-
Apr 16th, 2000, 05:08 PM
#1
Thread Starter
Fanatic Member
I have an Access table called Employee_Work_History_Days with the following fields :
Employee_Id - Text
Work_Date - Date
Payment_Id - Text
Gross - Currency
Week_Number - Number
Employee_Id, Work_Date and Payment_Id make up the primary key.
I need to total up the sum for the Gross for a particular Employee and Week Number. I can do this, but I also need it to ignore a specified Work_Date and Payment_Id.
For instance I need a total for the Gross for employee 'SWE0001' on Week_Number 1, except for the Payment_Id '02' on Work_Date 03/04/2000.
Can anybody help?
-
Apr 16th, 2000, 05:30 PM
#2
Frenzied Member
SELECT SUM(Gross) FROM Employee_Work_History_Days
WHERE Week_Number=1 AND NOT (Payment_ID=2 AND Work_Date = '03/04/2000')
This might work - I can't test it at the mo.
'Buzby'
Visual Basic Developer
"I'm moving to Theory. Everything works there."
-
Apr 16th, 2000, 05:55 PM
#3
Thread Starter
Fanatic Member
I was just about to close the thread and post a message saying I'd already figured it out when you replied.
I tried yours and with a some minor alterations it worked, so thanks a lot.
Heres how I had solved it :
SELECT SUM(Gross) AS GrossForWeek
FROM Employee_Work_History_Days
WHERE Employee_Id = 'SWE0001'
AND Week_Number = 1
AND Gross NOT IN
(SELECT Gross
FROM Employee_Work_History_Days
WHERE Employee_Id = 'SWE0001'
AND Payment_Id = '02'
AND Work_Date = #03/04/2000#)
Cheers anyway.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|