Subject Re: [ib-support] Name of Returned Field
Author ibrahim Bulut
Select distinct substr(ZIP,1,5) AS ZIP_CODE FROM TABLE1

Try this sql statement



----- Original Message -----
From: "Helen Borrie" <helebor@...>
To: <ib-support@yahoogroups.com>
Sent: Friday, November 23, 2001 9:35 AM
Subject: Re: [ib-support] Name of Returned Field


> At 08:25 AM 23-11-01 +0100, Nando Dessena wrote:
> >Robert,
> >
> > > 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.
>
> Helen
>
> All for Open and Open for All
> InterBase Developer Initiative ยท http://www.interbase2000.org
> _______________________________________________________
>
>
> To unsubscribe from this group, send an email to:
> ib-support-unsubscribe@egroups.com
>
>
>
> Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/
>
>