Subject Re: Select column AS [column name] with space
Author ramona.grissom
Tried the query and it fails.

This works:

select
ii.part_number,extractweekday(ih.inv_date),ih.inv_date,ih.part_number as
account_number
from invitems ih
join invitems ii
on ii.inv_id=ih.inv_id
group by ii.part_number,ih.inv_date,ih.inv_date,ih.part_number

Doesn't work:
select
ii.part_number,extractweekday(ih.inv_date),ih.inv_date,ih.part_number as
"account number"
from invitems ih
join invitems ii
on ii.inv_id=ih.inv_id
group by ii.part_number,ih.inv_date,ih.inv_date,ih.part_number

Tried, [account number], 'account number', etc.

Thanks

--- In firebird-support@yahoogroups.com, Alan J Davies <Alan.Davies@...> wrote:
>
> That will work.
> Here's a real-life example I just changed using your question:
> select
> ii.partno,sum(ii.inv_qty),extractweekday(ih.inv_date),ih.inv_date,ih.acno
> "account number"
> from invhead ih
> join invitems ii
> on ii.inv_nmbr=ih.inv_nmbr
> group by ii.partno,ih.inv_date,ih.inv_date,ih.acno
>
> select
> ii.partno,sum(ii.inv_qty),extractweekday(ih.inv_date),ih.inv_date,ih.acno as
> "account number"
> from invhead ih
> join invitems ii
> on ii.inv_nmbr=ih.inv_nmbr
> group by ii.partno,ih.inv_date,ih.inv_date,ih.acno
>
> Note that you do not require the "AS" although it may help with readability.
>
> Alan J Davies
> Aldis
>
> On 19/04/2013 16:14, ramona.grissom wrote:
> > How can we accomplish this in Firebird?
> >
> > In MSSQL for example you can SELECT column AS [column name]. The "column
> > name" can contain spaces and be named a reserved word because it's
> > escaped with the square brackets.
> >
> > But not sure about
> >
> > SELECT CustomerName AS "Customer Name"
> > FROM Customers
> >
> > Thank you in advance for your help.
> >
> >
>