How do i override the same column name in joining of two tables?
my code :
function choices() {
/* TODO : Add validation */
$crud = new grocery_CRUD();
$crud->set_theme('twitter-bootstrap');
$crud->set_table(DB_PREFIX . 'choice')
->set_subject('Choice');
$crud->set_relation('menu_id', DB_PREFIX . 'menu', 'menu_name');
$crud->where($crud->get_unique_join_name('menu_id').'.is_active','Y');
$crud->columns('menu_id', 'choice_name', 'is_active');
$crud->add_fields('menu_id', 'choice_name', 'is_active');
$crud->edit_fields('menu_id', 'choice_name', 'is_active');
$crud->display_as('menu_id', 'Menu');
$output = $crud->render();
$this->_grid_output($output);
}
database:
-- --------------------------------------------------------
--
-- Table structure for table `tbl_choice`
--
CREATE TABLE IF NOT EXISTS `tbl_choice` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`menu_id` int(11) NOT NULL,
`choice_name` varchar(55) NOT NULL,
`is_active` enum('Y','N') NOT NULL,
PRIMARY KEY (`id`),
KEY `menu_id` (`menu_id`),
KEY `rest_id` (`rest_id`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=6 ;
-- --------------------------------------------------------
--
-- Table structure for table `tbl_menu`
--
CREATE TABLE IF NOT EXISTS `tbl_menu` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`menu_name` varchar(255) NOT NULL,
`cat_id` int(11) NOT NULL,
`price` int(11) NOT NULL,
`is_active` enum('Y','N') NOT NULL,
PRIMARY KEY (`id`),
KEY `cat_id` (`cat_id`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=4 ;
--
-- Constraints for dumped tables
--
--
-- Constraints for table `tbl_choice`
--
ALTER TABLE `tbl_choice`
ADD CONSTRAINT `tbl_choice_ibfk_1` FOREIGN KEY (`menu_id`) REFERENCES `tbl_menu` (`id`) ON UPDATE CASCADE;
--
-- Constraints for table `tbl_menu`
--
ALTER TABLE `tbl_menu`
ADD CONSTRAINT `tbl_menu_ibfk_1` FOREIGN KEY (`cat_id`) REFERENCES `tbl_category` (`id`) ON UPDATE CASCADE;
Error ::
Error Number: 1052
Column 'is_active' in where clause is ambiguous
SELECT *FROM (`tbl_choice`) LEFT JOIN `tbl_menu` as j93e25458 ON `j93e25458`.`id` = `tbl_choice`.`menu_id` WHERE `j93e25458`.`is_active` = 'Y' AND `is_active` LIKE '%n%' HAVING `j93e25458`.`is_active` = 'Y' AND