Re: wildcard alias - Mailing list pgsql-general

From Joshua D. Drake
Subject Re: wildcard alias
Date
Msg-id 1163228141.6530.63.camel@localhost.localdomain
Whole thread Raw
In response to Re: wildcard alias  (Martijn van Oosterhout <kleptog@svana.org>)
List pgsql-general
On Fri, 2006-11-10 at 23:34 +0100, Martijn van Oosterhout wrote:
> I don't know what your query or aliases have to do with joins, but if
> you want to join two tables on all fields with the same name, you can
> do a NATURAL JOIN.
>
> Have a nice day,
>
> On Fri, Nov 10, 2006 at 05:17:12PM -0500, Matthew Terenzio wrote:
> >
> > I suppose I should have named things differently but is there a way to
> > join two tables with a bunch of identical column names and rather than
> > explicitly alias each column just use some sort of wildcard like:
> >
> > SELECT tablename.* AS  alias.*
> >
> > OR do I have to name each column like:
> >
> > columnname as alias
> >

Yes: SELECT foo as bar from baz;

Sincerely,

Joshua D. Drake



> > Thanks much.
> >
> >
> > ---------------------------(end of broadcast)---------------------------
> > TIP 9: In versions below 8.0, the planner will ignore your desire to
> >       choose an index scan if your joining column's datatypes do not
> >       match
>
--

      === The PostgreSQL Company: Command Prompt, Inc. ===
Sales/Support: +1.503.667.4564 || 24x7/Emergency: +1.800.492.2240
Providing the most comprehensive  PostgreSQL solutions since 1997
             http://www.commandprompt.com/

Donate to the PostgreSQL Project: http://www.postgresql.org/about/donate




pgsql-general by date:

Previous
From: novnov
Date:
Subject: Utility to Convert MS SQL Server to Postgres
Next
From: Richard Huxton
Date:
Subject: Re: [PL/pgSQL] Commit every N rows. Is it possible ?