K
Kim Baker
Hi guys
Hope someone can help.
I have a field in a table that has '0' as a default value that
indicates that no result has been temporarily stored.
When updated many of these values will change to the range of 95.00 to
103.00. Others will stay at '0'.
I am attempting to create a Sql statement that will return the average
of the non zero values.
In the QBE grid I can see all these values. When I add the criteria
'>0', I see only the non zero values.
However, when I select the aggregate function and choose Avg, it
returns a value of 84 instead of something between 95.00 and 103.00.
It seems to me that this might indicate that the SQL is averaging all
values and ignoring the criteria field. Not what I am after.
Pseudo code is similar to this:
SELECT Avg(tblTable1.field1)
FROM
WHERE this AND that AND ((Avg(tblTable1.field1)>0)
Can anyone point me to an example code that would allow me to first
select the non zero values and then average only those values?
Cheers
Remove undies to reply
Hope someone can help.
I have a field in a table that has '0' as a default value that
indicates that no result has been temporarily stored.
When updated many of these values will change to the range of 95.00 to
103.00. Others will stay at '0'.
I am attempting to create a Sql statement that will return the average
of the non zero values.
In the QBE grid I can see all these values. When I add the criteria
'>0', I see only the non zero values.
However, when I select the aggregate function and choose Avg, it
returns a value of 84 instead of something between 95.00 and 103.00.
It seems to me that this might indicate that the SQL is averaging all
values and ignoring the criteria field. Not what I am after.
Pseudo code is similar to this:
SELECT Avg(tblTable1.field1)
FROM
WHERE this AND that AND ((Avg(tblTable1.field1)>0)
Can anyone point me to an example code that would allow me to first
select the non zero values and then average only those values?
Cheers
Remove undies to reply