Subject Re: [ib-support] Name of Returned Field
Author Helen Borrie
At 08:25 AM 23-11-01 +0100, Nando Dessena wrote:
> > Select distinct substr(ZIP,1,5)
> >
> > returns a field named substr with all the values.
> >
> > This is really stupid.
>All expressions generate column names on which I would never count.
>I always use an alias if I need to impose a name (and I always need).
>BTW, what should it return? Should it use "ZIP" as the column name?
>Should I call "body" what is actually a leg?

Maybe Mr Tulloch misunderstood the purpose of SELECT DISTINCT. It is meant to tell the engine that you want a result set consisting of each DISTINCT row containing the named columns. It operates on output rows, not on the individual columns, so trying to work out DISTINCT on an expression is not in its scheme.

Or maybe he meant it was stupid to return a result instead of raising an error...with which I agree.


All for Open and Open for All
InterBase Developer Initiative ยท