[EMAIL PROTECTED] (David Fetter) writes:
I bumped across this several times, and am wondering what SQL99 and
SQL200x have to say about column numbers or aliases in HAVING.
SQL99 not only does not allow them in GROUP BY or HAVING, but it doesn't
allow them in ORDER BY either, thereby eliminating
Kind people,
I bumped across this several times, and am wondering what SQL99 and
SQL200x have to say about column numbers or aliases in HAVING. SQL92
is fairly clear (no) but also somewhat out of date.
Here's a scenario:
SELECT foo_name, count(*) as foo_count
FROM foo
GROUP BY foo_name
HAVING
On Mon, Feb 23, 2004 at 06:36:48PM -0500, Tom Lane wrote:
[EMAIL PROTECTED] (David Fetter) writes:
I bumped across this several times, and am wondering what SQL99
and SQL200x have to say about column numbers or aliases in HAVING.
SQL99 not only does not allow them in GROUP BY or HAVING,
David Fetter [EMAIL PROTECTED] writes:
Just in general, isn't it better to write a piece of code (here, a
possibly-complicated aggregate) just once and refer to it elsewhere
rather than have to write a separate copy of it everywhere it's used?
In general, you do that with subselects. Having