Subject Re: [firebird-support] Alias not working in having / utf8_ci
Author Helen Borrie
At 10:14 AM 22/11/2007, you wrote:
>Hi all,
>Running 2.1 beta 2, win32

You shouldn't use this list for questions about alphas and betas. Please read the instructions at the beginning of the release notes and/or the rules for this list.

>ยง1:
>SELECT count("UID") as a2
>FROM "Units"
>where "PostalCode" is not null
>group by "PostalCode"
>having count("UID")>3 //not working: having a2>3
>order by a2 desc
>
>a2 works fine in order-clause, but not in having.
>Bugging, but bug or the fb-way? (having a2 works in mys*l)

Hmm,

a) there's a certain lack of logic there: the field "PostalCode" is missing, so what is the query going to group?
b) without looking it up, I'm not sure that 2.1 yet has the ability to support referring to aggregations by the identifier of the expression output.
c) Never treat mysql as the paragon of standard SQL implementation. ;-)

Try this:

SELECT
"PostalCode",
count("UID") as a2
FROM "Units"
where "PostalCode" is not null
group by "PostalCode"
having count("UID")>3
order by 2 desc

Take the UTF8 question to Firebird-devel please. That's definitely an area that's "under development" and there simply isn't yet enough documentation about the final picture. Sadly. I have an issue of the Developer Magazine themed on Unicode and ICU that has been "on ice" for six months, waiting for the kind of information you are (quite justifiably) asking about.

^ heLen