I have a problem when using tree categories structure, parent_id is a foreign key to the category id.
->set_relation('parent_id', 'categories', 'display_name')
Everything is ok when add or edit, but when i filtering some column in list, it show ambiguous column name sql error.
Column 'seq' in where clause is ambiguous
SELECT `categories`.*, j6be37982.display_name AS s6be37982, `categories`.display_name AS 'categories.display_name' FROM `categories` LEFT JOIN `categories` as `j6be37982` ON `j6be37982`.`id` = `categories`.`parent_id` WHERE `seq` LIKE '%1%' ESCAPE '!' LIMIT 10
Here is my table schema
CREATE TABLE IF NOT EXISTS `categories` ( `id` int(10) unsigned NOT NULL, `parent_id` int(10) unsigned DEFAULT '0' , `layer` tinyint(3) unsigned DEFAULT '0' , `name` varchar(64) NOT NULL , `display_name` varchar(255) NOT NULL , `seq` mediumint(8) unsigned NOT NULL DEFAULT '999', `created_at` datetime NOT NULL, `updated_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP ) ENGINE=InnoDB AUTO_INCREMENT=137 DEFAULT CHARSET=utf8;
I know the solution is to add table name before the field name when set relation to self.
But i can't find where to put code in grocery library.