Subject | RE: [firebird-support] Named columns in Select |
---|---|
Author | Tim Gahnström |
Post date | 2005-05-02T11:30:43Z |
> -----Original Message-----Thanks a lot! It solved the problem in a heartbeat.
> From: Martijn Tonies [mailto:m.tonies@...]
> > 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 are some
> other
> way to name the output from substring function.
>
> Indeed.
>
> Try a:
> group by substring(name from 1 for 1)
I would still have preferred a named column because of the cleaner look and probably speed but if there aren't one this will do
I don't know how it is implemented but it certainly looks like the below will make two runs through the table, once in the select and 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