Re: wildcard alias

From: "Joshua D(dot) Drake" <jd(at)commandprompt(dot)com>
To: Martijn van Oosterhout <kleptog(at)svana(dot)org>
Cc: Matthew Terenzio <matt(at)jobsforge(dot)com>, PostgreSQL general <pgsql-general(at)postgresql(dot)org>
Subject: Re: wildcard alias
Date: 2006-11-11 06:55:40
Message-ID: 1163228141.6530.63.camel@localhost.localdomain
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Richard Huxton 2006-11-11 10:13:53 Re: [PL/pgSQL] Commit every N rows. Is it possible ?
Previous Message novnov 2006-11-11 06:26:51 Utility to Convert MS SQL Server to Postgres