Hello,
working in access 2003 and having a strange problem today. I need a query that selects a list of names from a table called EmployeeTask_FTE where thesum of the field FTE (numeric- double) is equal to 1 for at least one month in the specified 3-month range. I do this via a subquery that first sums the FTE values for the month:
and then use this in a query that selects only the ones that equal 1:
I then use the list of names as a source for another query to be used in a report.
Here is the problem: even though the first subquery works just fine and gives me all the right people with the right FTE values, the 'select distinct names' query does not display everyone who has sum(FTE)=1. A couple of people are missing. I checked these people in the EmployeeTask_FTE table- they each have a total of FTE=1. I even manually re-typed their FTE entries in the table. Everything is fine with them.
Another complication is that when I type "where TotalFTE like '1' " instead of "=1" the query displays the people that were missing- BUT a few other different records are now not being displayed. The rest 100 or so records with TotalFTE=1 are unaffected either way and continue to display.
Can someone tell me how a query can treat a field as both text and numeric and produce some correct and some incorrect results in either case? Please let me know if I'm missing something here- I've never seen a query do this before.
Thank you in advance!
working in access 2003 and having a strange problem today. I need a query that selects a list of names from a table called EmployeeTask_FTE where thesum of the field FTE (numeric- double) is equal to 1 for at least one month in the specified 3-month range. I do this via a subquery that first sums the FTE values for the month:
PHP:
SELECT LastName, FirstName, sum(FTE) AS TotalFTE, FTEMonthStart
FROM EmployeeTask_FTE
WHERE FTEMonthStart Between [startdate] And dateadd("m", 2,[startdate]) And WorkTimeType Like 'REG'
GROUP BY LastName, FirstName, FTEMonthStart;
and then use this in a query that selects only the ones that equal 1:
PHP:
Select distinct LastName, FirstName from
(SELECT LastName, FirstName, sum(FTE) AS TotalFTE, FTEMonthStart
FROM EmployeeTask_FTE
WHERE FTEMonthStart Between [startdate] And dateadd("m", 2,[startdate]) And WorkTimeType Like 'REG'
GROUP BY LastName, FirstName, FTEMonthStart)
where TotalFTE=1;
I then use the list of names as a source for another query to be used in a report.
Here is the problem: even though the first subquery works just fine and gives me all the right people with the right FTE values, the 'select distinct names' query does not display everyone who has sum(FTE)=1. A couple of people are missing. I checked these people in the EmployeeTask_FTE table- they each have a total of FTE=1. I even manually re-typed their FTE entries in the table. Everything is fine with them.
Another complication is that when I type "where TotalFTE like '1' " instead of "=1" the query displays the people that were missing- BUT a few other different records are now not being displayed. The rest 100 or so records with TotalFTE=1 are unaffected either way and continue to display.
Can someone tell me how a query can treat a field as both text and numeric and produce some correct and some incorrect results in either case? Please let me know if I'm missing something here- I've never seen a query do this before.
Thank you in advance!