Subject Re: [firebird-support] Named columns in Select
Author Martijn Tonies
Hello,

> I am trying to get all the first letters out of the column NAME by using
the substring function and the group by clause.
>
> It seems straight forward but apparently I am using the AS keyword wrong.
>
> My function looks like below and I want :ltr_out to be a list of all the
initial letters in the name column to make a clickable index containing only
the active letters.
>
> 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)

With regards,

Martijn Tonies
Database Workbench - developer tool for InterBase, Firebird, MySQL & MS SQL
Server
Upscene Productions
http://www.upscene.com