Dennis Lee Bieber
1/30/2008 6:11:00 PM
On Wed, 30 Jan 2008 09:04:26 -0800 (PST), beef <winterbeef@gmail.com>
declaimed the following in comp.lang.python:
> SELECT
> shots.*,
> users.*,
> sequences.*,
> jobs.*
> FROM
> shots
> LEFT JOIN
> users ON users.id=shots.user_id
> INNER JOIN
> sequences ON sequences.id=shots.sequence_id
> INNER JOIN
> jobs AS j ON j.id=sequences.job_id
> WHERE
> shots.id=%s
>
> 3. The 'shots' id has the key name of 'id', while all the -other-
> 'id's have key names of the form: "<TABLE>.id"
>
The <TABLE> prefix is probably being used when the query processor
discovers that there are duplicate field names. IE, it is just
processing the table descriptions from left to right, and when a
subsequent table has the same field name as one that has already been
used, it prefaces the second (third, ...) with the source table.
> I would prefer to have the key names consistent, so that event the
> "shots" fields have key names of the form "<TABLE>.id"
>
Suggest, first step, do NOT use "table.*" notation, but rather
explicitly list the fields you want from each table, in the order you
want them. That, alone, might add the table names to all fields, though
I suspect not -- so use an "as xxx" renaming of the fields you need to
differentiate.
... shots.id as "shots.id", other.fields, other.tables...
--
Wulfraed Dennis Lee Bieber KD6MOG
wlfraed@ix.netcom.com wulfraed@bestiaria.com
HTTP://wlfraed.home.netcom.com/
(Bestiaria Support Staff: web-asst@bestiaria.com)
HTTP://www.bestiaria.com/