db-derby-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Robert Enyedi <robert.eny...@intland.com>
Subject Re: GROUP_BY with user functions
Date Mon, 18 Sep 2006 11:25:38 GMT
Wow, this really works. Thanks a lot, Fernanda!

I just wonder why the alias propagation works well in this scenario and 
with the obvious one it does not.

Regards,
Robert

Fernanda Pizzorno wrote:
> Have you tried this?
>
> SELECT my_value
> FROM
>    (SELECT MY_USER_FUNCTION(t1.field1) AS my_value
>     FROM T1) AS UserFunction
> GROUP BY my_value
>
> Regards,
> - Fernanda
>
>
> Robert Enyedi wrote:
>> Thanks for the tip. I tried this, but it has the same problem with 
>> alias referencing.
>>
>> Regards,
>> Robert
>>
>> Øystein Grøvlen wrote:
>>> Robert Enyedi wrote:
>>>
>>>> If I need to group the values returned by the MY_USER_FUNCTION, I 
>>>> simply cannot do so because the following query is invalid in Derby:
>>>>
>>>> SELECT MY_USER_FUNCTION(t1.field1) AS MY_VALUE
>>>> FROM T1
>>>> GROUP BY MY_VALUE
>>>>
>>>
>>> I have not tried this, but maybe something like this will work:
>>>
>>> SELECT UserFunction.value AS my_value
>>> FROM
>>>     (SELECT MY_USER_FUNCTION(t1.field1) AS value
>>>      FROM T1) AS UserFunction
>>> GROUP BY my_value
>>>
>>> -- 
>>> Øystein
>>>
>>
>
>


Mime
View raw message