Subject | Re: [firebird-support] Using field alias in having clause |
---|---|
Author | Milan Babuskov |
Post date | 2008-02-22T10:58:41Z |
Uwe Grauer wrote:
does seem inconsistent here:
- You cannot use column alias in HAVING and WHERE:
select emp_no x
from employee
where x > 10;
- But you can in GROUP BY and ORDER BY:
select emp_no x, max(hire_date) y
from employee
group by x
order by y;
I tested this with 2.0.3. Maybe some of this stuff is improved in 2.1.
--
Milan Babuskov
http://www.flamerobin.org
> In the queryColumn aliases are only used to output a column name. However, Firebird
> "SELECT E_TOK, E_VAL, count(*) as ent_count
> FROM ENUM
> group by E_TOK, E_VAL
> having ent_count > 1"
> i get this:
> Dynamic SQL Error
> SQL error code =-206
> Column unknown
> ENT_COUNT
>
> Using "having count(*) > 1" doesn't give an error.
> Can someone please explain the reason for this?
does seem inconsistent here:
- You cannot use column alias in HAVING and WHERE:
select emp_no x
from employee
where x > 10;
- But you can in GROUP BY and ORDER BY:
select emp_no x, max(hire_date) y
from employee
group by x
order by y;
I tested this with 2.0.3. Maybe some of this stuff is improved in 2.1.
--
Milan Babuskov
http://www.flamerobin.org