Hi
I need to add a condition for a related table, not the main table.
This is my code:
$crud->set_table('Requests') ->set_subject('درخواست رزومه') ->columns('Resume_id','Users_id','Status') ->fields('Resume_id','Users_id','Status') ->required_fields('Resume_id','Users_id') ->set_relation('Users_id','Users','UserName') ->where('Users.Type = 2')
Now I have this error:
Error Number: 1054
Unknown column 'Users.Type' in 'where clause'
SELECT `Requests`.*, jc474b407.UserName AS sc474b407 FROM (`Requests`) LEFT JOIN `Users` as jc474b407 ON `jc474b407`.`id` = `Requests`.`Users_id` WHERE `Users`.`Type` = 2 ORDER BY `Requests`.`id` desc LIMIT 100
Filename: E:\Users\MohammadMahdi\Documents\Projects\Khayyamkar\system\database\DB_driver.php
Line Number: 330
And the problem is that the name of related table is 'jc474b407' and not Users anymore!
How can I add this WHERE to the query?
Thanks