Icon View Thread

The following is the text of the current message along with any replies.
Messages 1 to 6 of 6 total
Thread Filtering by a Math Function
Wed, Dec 27 2006 9:37 AMPermanent Link

"Marcio Ehrlich"
Is there a way to filter a query by a math function?
Considering two tables, one with names etc and other with the jobs these
people have been in, this query is being able to list the names according to
how many jobs each one has done.

SELECT C.*, COUNT(T.Code) As Counter
FROM Casting C
LEFT JOIN Trab T ON (T.Code = C.Code)
WHERE C.Active = True
GROUP BY C.NameProf
ORDER BY Counter Desc, C.NameProf

Now I want to filter by the Counter column, to list only those with more
then 10 jobs, or those with no job at all.
How?
Thanks,
Marcio

Wed, Dec 27 2006 11:26 AMPermanent Link

"Robert"

"Marcio Ehrlich" <marcioehrlich_at_ig.com.br> wrote in message
news:66C5228D-0DF8-4CF2-AED8-F30DCC35ABB6@news.elevatesoft.com...
> Is there a way to filter a query by a math function?

After the query is done, it is not a "math function" any more, it is a
standard field. Just set up a filter such as counter > 10, and filtered to
true.

Robert


Wed, Dec 27 2006 11:49 AMPermanent Link

"Marcio Ehrlich"
Great tip.
Thank you, Robert.
For the record, since COUNT( ) does not return Zero if no item is found, I
had to set the filter as "Counter IS NULL" to list the >1 rows.
Marcio

"Robert" <ngsemail2005withoutthis@yahoo.com.ar> escreveu:
> After the query is done, it is not a "math function" any more, it is a
> standard field. Just set up a filter such as counter > 10, and filtered to
> true.

Wed, Dec 27 2006 12:00 PMPermanent Link

"Robert"

"Marcio Ehrlich" <marcioehrlich_at_ig.com.br> wrote in message
news:A115855C-D57C-4CDA-9D44-3EAC9C24279B@news.elevatesoft.com...
> Great tip.
> Thank you, Robert.
> For the record, since COUNT( ) does not return Zero if no item is found, I
> had to set the filter as "Counter IS NULL" to list the >1 rows.

counter > 0 should also do it. To me, that is a bug. A counter should always
return a number, even if the number is zero.

Robert

Wed, Dec 27 2006 5:51 PMPermanent Link

Tim Young [Elevate Software]

Elevate Software, Inc.

Avatar

Email timyoung@elevatesoft.com

Marcio,

<< For the record, since COUNT( ) does not return Zero if no item is found,
I had to set the filter as "Counter IS NULL" to list the >1 rows. >>

What version of DBISAM are you using ?   This issue was fixed a while ago
and we test for it with every new build:

http://www.elevatesoft.com/scripts/incident.dll?action=viewaddr&category=dbisam&release=4.16&type=f&incident=1931

--
Tim Young
Elevate Software
www.elevatesoft.com

Fri, Dec 29 2006 1:22 PMPermanent Link

"Marcio Ehrlich"
4.01.
M.

"Tim Young [Elevate Software]" <timyoung@elevatesoft.com> escreveu:

> What version of DBISAM are you using ?   This issue was fixed a while ago
> and we test for it with every new build:

>
http://www.elevatesoft.com/scripts/incident.dll?action=viewaddr&category=dbisam&release=4.16&type=f&incident=1931
>

Image