[Zope] Joins can be tricky (was "how to join two table?")

Rod Za rodza@bhnet.com.br
Tue, 23 Nov 1999 01:55:12 -0200


> When you join two tables which have column names in common and do select
> both columns from each table than Zope raises an error:
> Error, exceptions.ValueError: Duplicate column name, ID
> In this case "ID" was a common column name among the two tables. What
> happens is logical and expected, Zope cannot deal with two variables with
> the same name in the same namespace!
> The solution was pointed by Andy Dustman, and it works well for MySQL at
> least: use the "as" syntax to rename columns names. Example:
>
> Instead of:
>
> select clients.id, columns.id
> from clients,products
>
> you can use:
>
> select clients.id as clients_id,products.id as products_id
> from clients,products
>
> This way you get unique names and Zope stops to complaint.
>
> I don't know if this is mysql-specific  idiom or official SQL language,
but
> some variant may exist for most databases.

Alan i try this with ZODBC and work.

>
> I am thinking about writing a small how-to about this, any suggestion?
>
> Alan
>
When u write, please say to me.
I am new for Zope and Databases, i am trying to make a site (for a school
work) and i have too much dificult to do that, if i dont have help from
persons like you and Jim Sanford (thanx Jim) i never can do nothing! :-)

If i can suggest somethings, i like to suggest a how-to from beggin to end
(basic things from how to configure an ODBC manange to some SQL tips like
that you give me).


Any way, i like to thankful you for the help.

Rod Za.
ps. sorry for my poor english.