P
Paul
Hi all,
I hope somone can help me with a query. I have two queries the first
is saved as an access query called qryStdHrs and the SQL is below
SELECT qryStdHrs.Name, Sum(qryStdHrs.Hours) AS SumOfHours
FROM [SELECT tblPeople.Name AS Name, tblTimeSheet.Date,
Sum(tblTimeSheet.Hours) AS Hours FROM tblPeople INNER JOIN
tblTimeSheet ON tblPeople.ID = tblTimeSheet.FKPeopleID
GROUP BY tblPeople.Name, tblTimeSheet.Date, tblTimeSheet.FKStatusID
HAVING (((tblTimeSheet.Date) Between #06/30/2003# And #07/04/2003#))].
AS qryStdHrs
GROUP BY qryStdHrs.Name;
The second is called qryPreHrs and the SQL is below
SELECT qryPreHrs.Name, Sum(Hours) AS SumOfHours
FROM [SELECT tblPeople.Name AS Name, tblTimeSheet.Date,
Sum(tblTimeSheet.Hours) AS Hours FROM tblPeople INNER JOIN
tblTimeSheet ON tblPeople.ID = tblTimeSheet.FKPeopleID
GROUP BY tblPeople.Name, tblTimeSheet.Date
HAVING (((tblTimeSheet.Date) Between #07/07/2003# And #07/07/2003#))].
AS qryPreHrs
GROUP BY qryPreHrs.Name;
Now I can join them using another Query called qryStdPreHrs and the
SQL is below
SELECT qryStdHrs.Name, qryStdHrs.SumOfHours, qryPreHrs.SumOfHours
FROM qryStdHrs LEFT JOIN qryPreHrs ON qryStdHrs.Name = qryPreHrs.Name;
Now this works fine.
But I want to be able to write it as one SQL statement, and I just
cant work out how.
Hope somone can help.
Paul.
I hope somone can help me with a query. I have two queries the first
is saved as an access query called qryStdHrs and the SQL is below
SELECT qryStdHrs.Name, Sum(qryStdHrs.Hours) AS SumOfHours
FROM [SELECT tblPeople.Name AS Name, tblTimeSheet.Date,
Sum(tblTimeSheet.Hours) AS Hours FROM tblPeople INNER JOIN
tblTimeSheet ON tblPeople.ID = tblTimeSheet.FKPeopleID
GROUP BY tblPeople.Name, tblTimeSheet.Date, tblTimeSheet.FKStatusID
HAVING (((tblTimeSheet.Date) Between #06/30/2003# And #07/04/2003#))].
AS qryStdHrs
GROUP BY qryStdHrs.Name;
The second is called qryPreHrs and the SQL is below
SELECT qryPreHrs.Name, Sum(Hours) AS SumOfHours
FROM [SELECT tblPeople.Name AS Name, tblTimeSheet.Date,
Sum(tblTimeSheet.Hours) AS Hours FROM tblPeople INNER JOIN
tblTimeSheet ON tblPeople.ID = tblTimeSheet.FKPeopleID
GROUP BY tblPeople.Name, tblTimeSheet.Date
HAVING (((tblTimeSheet.Date) Between #07/07/2003# And #07/07/2003#))].
AS qryPreHrs
GROUP BY qryPreHrs.Name;
Now I can join them using another Query called qryStdPreHrs and the
SQL is below
SELECT qryStdHrs.Name, qryStdHrs.SumOfHours, qryPreHrs.SumOfHours
FROM qryStdHrs LEFT JOIN qryPreHrs ON qryStdHrs.Name = qryPreHrs.Name;
Now this works fine.
But I want to be able to write it as one SQL statement, and I just
cant work out how.
Hope somone can help.
Paul.