wes k said:
wes k said:
that is what i'm thinking. hopefully, you will be able to
direct me
in the
right area.
here is a sample
TABLE 1
EmpID Date Hours Pay (this is calculated)
1 6/1/07 5 $50
1 6/2/07 10 $100
1 6/3/07 7 $70
TABLE 2
EmpID Date Payment
1 5/31/07 -$200
1 6/3/07 -$30
The desired output would be as follows:
1 5/31/07 -$200
1 6/1/07 $50
1 6/2/07 $100
1 6/3/07 $70
1 6/3/07 -$30
The result showing an overpayment of $10
Does that help?
Wes
:
Wes,
Two Queries.
Query1:
SELECT T1.EmpID
,T1.[Date]
,<your calculation here> AS Payment
FROM [Table 1] AS T1
UNION ALL
SELECT T2.EmpID
,T2.[Date]
,T2.Payment
FROM [Table 2] AS T2
(UNION ALL retains all rows. If you have dups you wish to remove,
remove ALL.)
Query2:
SELECT Q1.EmpID
,SUM(Q1.Payment)
FROM Query1 AS Q1
GROUP BY Q1.EmpID
Sincerely,
Chris O.
Thanks.
I've been stuck in the rut of creating my queries in the design view of the
system. I'd like to become more comfortable with the script based method.
Could you direct me to a training material source for this?
:
Wes,
You are welcome.
If you are pre-MS Access 2007, then open MS Access Help, and switch to
the Contents tab. There should be a book/node for "Microsoft JET SQL
Reference". Its dry and dusty, but it's the core. You'd refer to it
for answers on specific questions, not for how to learn SQL in MS
Access (It should also be on your harddrive somewhere as
JETSQL40.chm)
A couple of good beginning references are:
SQL Queries for Mere Mortals by Michael J. Hernandez, John L. Viescas
Database Design for Mere Mortals by Michael J. Hernandez
SQL Tutorial:
http://www.w3schools.com/sql/default.asp
(Remember that there are some differences between MS Access and the
standard SQL taught here. If something you learn here doesn't work in
MS Access, refer to JETSQL40.chm for the final word.)
And some websites for MS Access:
http://www.mvps.org/access
http://allenbrowne.com/
http://home.bendbroadband.com/conradsystems/accessjunkie/resources.html#Top
http://www.rogersaccesslibrary.com/
Sincerely,
Chris O.