Gossamer Forum
Home : Products : Gossamer Links : Discussions :

Bad columns / column clash cannot be solved

Quote Reply
Bad columns / column clash cannot be solved
Hi,

I ran over a promblem while trying to select from multiple tables.
There are Column Names which are in two tables. When I use a condition

Code:
my $cond = GT::SQL::Condition->new(SUPPLIER_ID => LIKE => "$query->{SUPPLIER_ID}");

I get the error:

Quote:
GT::SQL::Relation (3980): Bad columns / column clash: columns named

Turning it to table

Code:
my $cond = GT::SQL::Condition->new(TABLE.SUPPLIER_ID => LIKE => "$query->{SUPPLIER_ID}");

does something confusing and I cannot find a solution in Condition.pm

Quote:
Failed to execute query: 'SELECT * FROM ... AND (TABLE_SUPPLIER_ID LIKE ...)': Unknown column 'TABLE_SUPPLIER_ID' in ...

Thanks for any hint

Niko

Last edited by:

el noe: Dec 29, 2008, 1:08 AM
Quote Reply
Re: [el noe] Bad columns / column clash cannot be solved In reply to
Hi,

That error means there are 2 fields that meet the same name - i.e you have SUPPLIER_ID in both your tables. Can you provide a few more details, like the real table names etc?

Code:
my $cond = GT::SQL::Condition->new(TABLE.SUPPLIER_ID => LIKE => "$query->{SUPPLIER_ID}")

..should be something more like:

Code:
my $cond = GT::SQL::Condition->new('Links.SUPPLIER_ID' => LIKE => "$query->{SUPPLIER_ID}")

(or whatever the table is)

Cheers

Andy (mod)
andy@ultranerds.co.uk
Want to give me something back for my help? Please see my Amazon Wish List
GLinks ULTRA Package | GLinks ULTRA Package PRO
Links SQL Plugins | Website Design and SEO | UltraNerds | ULTRAGLobals Plugin | Pre-Made Template Sets | FREE GLinks Plugins!
Quote Reply
Re: [Andy] Bad columns / column clash cannot be solved In reply to
Hi Andy,

thank you for your quick reply. That´s correct the Name is in both tables. That ´s what lead me to the second try which has the prefix of the table like you mentioned it in your post.
The problem is that Condition or some other part seems not to accept the "." as seperator for TABLE. COL .
This leads to the second error.

I have two tables RAW_AID and BASE_AID have the same names and content:
RAW:
RAW_AID (pk)
SUPPLIER_ID
SUPPLIER_AID
BASE_AID
BASE_AID_SOURCE


RAW_ARTICLE_DETAILS:
RAW_AID (pk)
EAN
MANUFACTURER_ID
MANUFACTURER_AID
MANUFACTURER_AID_SHORT
BRAND_ID
BASE_AID

Regards

Niko
Quote Reply
Re: [el noe] Bad columns / column clash cannot be solved In reply to
Did you try it like I suggested? With the '' around it?

i.e

'Table.Field'

..instead of:

Table.Field

Cheers

Andy (mod)
andy@ultranerds.co.uk
Want to give me something back for my help? Please see my Amazon Wish List
GLinks ULTRA Package | GLinks ULTRA Package PRO
Links SQL Plugins | Website Design and SEO | UltraNerds | ULTRAGLobals Plugin | Pre-Made Template Sets | FREE GLinks Plugins!
Quote Reply
Re: [Andy] Bad columns / column clash cannot be solved In reply to
Blush I thought I already did but it looks like I did not thank you very much it works.

Thank you very much for your time.

Niko
Quote Reply
Re: [el noe] Bad columns / column clash cannot be solved In reply to
heheh np - glad it worked Cool

Cheers

Andy (mod)
andy@ultranerds.co.uk
Want to give me something back for my help? Please see my Amazon Wish List
GLinks ULTRA Package | GLinks ULTRA Package PRO
Links SQL Plugins | Website Design and SEO | UltraNerds | ULTRAGLobals Plugin | Pre-Made Template Sets | FREE GLinks Plugins!