B-219 Sec-55 Noida, India
+918010221733

Mysql ambiguous Error in admin grid filter in magneto or “SQLSTATE[23000]: Integrity constraint violation: 1052 Column ‘status’ in where clause is ambiguous

if you have same name of column in collection and in grid when you filter it you will get one my sql error

SQLSTATE[23000]: Integrity constraint violation: 1052 Column ‘status’ in where clause is ambiguous at that time in grid _prepareColumns() funtion
add filter_index option in fields that is

$this->addColumn("status", array(
                
"header" => Mage::helper("custompromotion")

                                             ->__("Status"),
                
"align" =>"left",
                
"index" => "status",
                
"filter_index" => "main_table.status",
                
'type'      =>  'options',
                
'options'   =>  $option,
                ));

“filter_index” =>; “main_table.status”,
main_table.status==> “main_table” is alias of you table and “status” is column
this issue will happen when you join 2 tables and have same field name 

(Visited 52 times, 1 visits today)

Leave a reply