Re: GROUP BY

From: V.J. Kumar <vjkmail_at_gmail.com>
Date: Sun, 20 May 2007 20:02:19 +0200 (CEST)
Message-ID: <Xns99368EFC182Avdghher_at_194.177.96.26>


Lennart <erik.lennart.jonsson_at_gmail.com> wrote in news:f2ph1v$u15$1_at_registered.motzarella.org:

> V.J. Kumar wrote:
> [...]

>>> 
>>> T431, "Extended grouping capabilities"
>>> 
>>> I believe this is the same feature as where group by grouping sets, 
>>> rollup and cube are defined.
>> 
>> What have 'extended grouping capabilities' got to do with the claim
>> that the simple 'group by' miraculously creates a tuple out of
>> nothing ? 

>
> I dont have sql99 at hand so I can not verify it, but I would not
> concider it particulary strange if grouping by an emtpy set where part
> of "Extended grouping capabilities"
>
>>  It 
>> does not,  either in the implementations I referred to or in the '92 
>> standard.  Neither does it in '99, btw !  Also 'select 1 from t1
>> group by grouping sets ()' is syntactically incorrect in both
>> implementations. 
>> 

>
> Yes of course, you need a set of groups:
>
> select 1 from t1 group by grouping sets (())

That is correct, although the correct syntax does not help you much with SQL Server because it does not have the 'grouping sets' functionality.

>
> which I imagine is the same as:
>
> select 1 from t1 group by ()

In other implemmentations in accordance with the 2003 standard, you will still obtain zero rows, either with 'group by ()' or 'group by grouping sets (())'. Not surprising really.

>
>
> /Lennart
Received on Sun May 20 2007 - 20:02:19 CEST

Original text of this message