Just another WordPress.com weblog

For example in our custom module we have to add order_id in grid, if we search by order id in grid than such type of error occurs.

SQLSTATE[23000]: Integrity constraint violation: 1052 Column ‘Order_id’
in where clause is ambiguous

to resolve such error we can add ‘filter_index’=>’main_table.order_id’ in $this->addColumn() function


$this->addColumn('order_id', array(
'header' => Mage::helper('couponcode')->__('Order Id'),
'align' =>'left',
'index' => 'order_id',
'filter_index'=>'main_table.order_id', // This parameter helps to resolve above error
));

Thanks,
Bijal Bhavsar 🙂

Advertisements

Comments on: "Integrity constraint violation: 1052 Column in where clause is ambiguous”" (5)

  1. Hey Bijal ,

    Thanks, it is working like a charm , thanks a lot

    Thanks
    Harsh

  2. finally worked thanks..

  3. I bow to you, master! Thank you very much!

  4. Great help, Thanks a lot

  5. Avtar Singh said:

    Great work. Thanks a lot.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: