Re: GROUP BY ALL not as expected
- From: Luc Van der Veurst <dba_azvub@xxxxxxxxxxx>
- Date: 11 Oct 2007 07:24:28 GMT
Manish Negandhi <negandhi.manish@xxxxxxxxx> wrote:
Here is what Sybase says for this behaviour
"If any columns in the select list do not have aggregate functions
applied to them and are not included in the query's group by clause
(illegal in standard SQL), the meanings of having and where are
somewhat different.
In this situation, a where clause restricts the rows that are included
in the calculation of the aggregate, but does not restrict the rows
returned by the query. Conversely, a having clause restricts the rows
returned by the query, but does not affect the calculation of the
aggregate. See group by and having clauses for examples."
http://manuals.sybase.com/onlinebooks/group-as/asg1250e/refman/@Generic__BookTextView/68329;pt=68329#X
Thanks
Manish
True, but not applicable for this query. All the columns in the select
list that do not have aggregate functions applied to them are included
in the group by clause.
Luc.
.
On Oct 10, 6:40 pm, --CELKO-- <jcelko...@xxxxxxxxxxxxx> wrote:
I don't know what the sql standard says about this .. <<
Nothing; this is not Standard SQL. Look up "grouping sets", "rollup"
and "cube" for the newer extensions to GROUP BY.
- References:
- GROUP BY ALL not as expected
- From: Mintcake
- Re: GROUP BY ALL not as expected
- From: Luc Van der Veurst
- Re: GROUP BY ALL not as expected
- From: --CELKO--
- Re: GROUP BY ALL not as expected
- From: Manish Negandhi
- GROUP BY ALL not as expected
- Prev by Date: Re: SELECT to return records with dates
- Next by Date: Re: SELECT to return records with dates
- Previous by thread: Re: GROUP BY ALL not as expected
- Next by thread: SELECT to return records with dates
- Index(es):
Relevant Pages
|