I am not sure what is happening here. I am trying to query a table (DyessD23) to count up how many documents are in a certain status (cur). For the most part the query works - but returns numbers that are WAY off. If I go through the table and count myself I come up with numbers nearly 1/2 of what the query returns.
here is the SQL for the query:
Results from this query are:
364 77 0 (totals)
Since this isn't working - I thought I would pull all the documents - using the same basic query setup (tables/joins) and instead of counting the documents, just list them. This is the code I used for that:
Total number of records listed with this query is 212. So, I would expect the first query to total this, but instead I get 441. Again, going through the whole DyessD23 table I come up with 212 manually.
Any ideas on what could be causing the 'sum(iif(xxx ' lines to be getting so many hits?
Thanks
here is the SQL for the query:
Code:
SELECT Area.Element, Sum(IIf([dyessd23]![cur]="INW" Or [DyessD23]![CUR]="AWM" Or [DyessD23]![CUR]="FWP" Or [DyessD23]![CUR]="MTM",1,0)) AS [Dys AWM], Sum(IIf([dyessd23]![cur]="0*P" Or [DyessD23]![CUR]="AWP",1,0)) AS [Dys AWP], Sum(IIf(DyessD23!CUR="DWP",1,0)) AS [Dys DWP]
FROM Area INNER JOIN (lru INNER JOIN DyessD23 ON lru.NSN = DyessD23.NSN) ON Area.ID = lru.Team
WHERE (((DyessD23.LOC)="B1B"))
GROUP BY Area.Element;
364 77 0 (totals)
Since this isn't working - I thought I would pull all the documents - using the same basic query setup (tables/joins) and instead of counting the documents, just list them. This is the code I used for that:
Code:
SELECT DyessD23.doc, lru.abbr, DyessD23.cur
FROM (lru INNER JOIN Area ON lru.Team = Area.ID) INNER JOIN DyessD23 ON lru.NSN = DyessD23.NSN
WHERE (((DyessD23.loc)="b1b"))
GROUP BY DyessD23.doc, lru.abbr, DyessD23.cur;
Any ideas on what could be causing the 'sum(iif(xxx ' lines to be getting so many hits?
Thanks