pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Martin Marques <martin@marquesminen.com.ar>
To: Bryce Nesbitt <bryce1@obviously.com>
Cc: pgsql-sql@postgresql.org
Subject: Re: Syntax question: use of join/using with fully qualified table name
Date: Sun, 27 Jan 2008 23:43:04 -0200
Message-ID: <479D3328.50903@marquesminen.com.ar> (raw)
In-Reply-To: <479D2694.3090202@obviously.com>
References: <479D2694.3090202@obviously.com>

Bryce Nesbitt escribió:
> I've got a join where a certain column name appears twice:
> 
> select username,last_name from eg_member join eg_membership using
> (member_id) join eg_account using (account_id) join eg_person using
> (person_id);
> ERROR:  common column name "person_id" appears more than once in left table
> 
> 
> My first inclination was to fully quality the table name.  Why would
> this not be acceptable syntax?
> 
> select username,last_name from eg_member join eg_membership using
> (member_id) join eg_account using (account_id) join eg_person using
> (eg_member.person_id);
> ERROR:  syntax error at or near "." at character 145

Did you read the manual?

USING (join_column [, ...])

     A clause of the form USING ( a, b, ... ) is shorthand for ON 
left_table.a = right_table.a AND left_table.b = right_table.b .... Also, 
USING implies that only one of each pair of equivalent columns will be 
included in the join output, not both.





view thread (3+ messages)  latest in thread

Message-ID: <479D3328.50903@marquesminen.com.ar>
Permalink:  ../479D3328.50903@marquesminen.com.ar/
Also on:    postgresql.org/message-id/479D3328.50903@marquesminen.com.ar

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-sql@postgresql.org
  Cc: martin@marquesminen.com.ar, bryce1@obviously.com
  Subject: Re: Syntax question: use of join/using with fully qualified table name
  In-Reply-To: <479D3328.50903@marquesminen.com.ar>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox