Subject | Re: [firebird-support] conditional on count |
---|---|
Author | Helen Borrie |
Post date | 2007-02-10T22:46:38Z |
At 09:30 AM 11/02/2007, you wrote:
HAVING applies to the result of a grouping. So:
select CustomPlan_ID, count(*) as ItemCount
from CustomPlanInfo
group by 1
HAVING count(*) > 1
./heLen
>FB 1.5Yup. WHERE applies to searches, i.e. rows in the tables, whilst
>
>I would like to run the following SQL:
>
> select CustomPlan_ID, count(*) as ItemCount
> from CustomPlanInfo
> where ItemCount > 1 <<-- doesn't work
>group by 1
>
>But it doesn't like ItemCount. Is there a way to do this?
HAVING applies to the result of a grouping. So:
select CustomPlan_ID, count(*) as ItemCount
from CustomPlanInfo
group by 1
HAVING count(*) > 1
./heLen