Subject | Re: Named columns in Select |
---|---|
Author | Ali Gökçen |
Post date | 2005-05-02T12:13:46Z |
Hi Tim,
...
group by 1
isn't enough?
Ali
--- In firebird-support@yahoogroups.com, Tim Gahnström
<tim.gahnstrom@i...> wrote:
once in the group by doing essentially the same thing.
...
group by 1
isn't enough?
Ali
--- In firebird-support@yahoogroups.com, Tim Gahnström
<tim.gahnstrom@i...> wrote:
> > -----Original Message-----are some
> > From: Martijn Tonies [mailto:m.tonies@u...]
> > > begin
> > > for
> > > select substring(name from 1 for 1) as letter
> > > from T_MOVIES
> > > group by letter
> > > into :ltr_out
> > > do suspend;
> > > end
> > >
> > > I get the error message
> > > --------
> > > Column unknown.
> > > LETTER.
> > > --------
> > >
> > > I have also tried omitting the AS keyword but I guess there
> > otherlook and probably speed but if there aren't one this will do
> > way to name the output from substring function.
> >
> > Indeed.
> >
> > Try a:
> > group by substring(name from 1 for 1)
>
> Thanks a lot! It solved the problem in a heartbeat.
>
> I would still have preferred a named column because of the cleaner
>below will make two runs through the table, once in the select and
> I don't know how it is implemented but it certainly looks like the
once in the group by doing essentially the same thing.
>
> select substring(name from 1 for 1)
> from T_MOVIES
> where name=name
> group by substring(name from 1 for 1)
> into :ltr_out
>
> Many thanks
>
> Tim