Thread: select, columns, and aliases

select, columns, and aliases

From
CSN
Date:
Is it possible to automatically prefix a table alias
(or table name or something else even) to each column
in a select list? For example:

select a.*, b.*
from tablea a
inner tableb b
on a.id=b.aid;

results:

a_id, a_name, b_id, b_name, b_aid


CSN




__________________________________
Do you Yahoo!?
Vote for the stars of Yahoo!'s next ad campaign!
http://advision.webevents.yahoo.com/yahoo/votelifeengine/

Re: select, columns, and aliases

From
Bruno Wolff III
Date:
On Fri, Jul 23, 2004 at 02:48:01 -0700,
  CSN <cool_screen_name90001@yahoo.com> wrote:
> Is it possible to automatically prefix a table alias
> (or table name or something else even) to each column
> in a select list? For example:
>
> select a.*, b.*
> from tablea a
> inner tableb b
> on a.id=b.aid;
>
> results:
>
> a_id, a_name, b_id, b_name, b_aid

I don't know of any Postgres feature that allows for computed aliases
at the SQL level. If the SQL is being generated by a program, the
program could potentially do this for you.

Re: select, columns, and aliases

From
CSN
Date:
???

--- Michael Kleiser <mkl@webde-ag.de> wrote:
> select a.*, b.*
>   from tablea AS a
>   inner tableb AS b
>   on a.id=b.aid;
>
>
> CSN schrieb:
> > Is it possible to automatically prefix a table
> alias
> > (or table name or something else even) to each
> column
> > in a select list? For example:
> >
> > select a.*, b.*
> > from tablea a
> > inner tableb b
> > on a.id=b.aid;
> >
> > results:
> >
> > a_id, a_name, b_id, b_name, b_aid
> >
> >
> > CSN
> >
> >
> >
> >
> > __________________________________
> > Do you Yahoo!?
> > Vote for the stars of Yahoo!'s next ad campaign!
> >
>
http://advision.webevents.yahoo.com/yahoo/votelifeengine/
> >
> > ---------------------------(end of
> broadcast)---------------------------
> > TIP 2: you can get off all lists at once with the
> unregister command
> >     (send "unregister YourEmailAddressHere" to
> majordomo@postgresql.org)
>
>


__________________________________________________
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around
http://mail.yahoo.com