[eluser]german.zvonchuk[/eluser]
Hello, codeigniter developers.
I have a problem with Flexigrid. I have a table with some fields which feeds flexigrid. When I run the below code, I get some fields under the flexigrid table to search by fields. When I select client_fullname, it tries to search client_fullname field on the selected table but there is no such field. I know I can do it using subquery but I don't know how to do it with active records.
Code:
SELECT
CONCAT(IFNULL(client_name, ""), " ", IFNULL(CONCAT(SUBSTRING(client_patronymic, 1, 1), "."), ""), " ", IFNULL(client_lastname, "")) AS client_fullname,
DATE_FORMAT(reg_date, "%Y-%m-%d %H:%i") AS reg_date,
DATE_FORMAT(date_issue_login, "%Y-%m-%d %H:%i") AS date_issue_login,
login,
agent_login
FROM (account)
WHERE login = '151501'
ORDER BY reg_date DESC
LIMIT 1
Active Record code is below:
Code:
SELECT
CONCAT(IFNULL(client_name, ""), " ", IFNULL(CONCAT(SUBSTRING(client_patronymic, 1, 1), "."), ""), " ", IFNULL(client_lastname, "")) AS client_fullname,
DATE_FORMAT(reg_date, "%Y-%m-%d %H:%i") AS reg_date,
DATE_FORMAT(date_issue_login, "%Y-%m-%d %H:%i") AS date_issue_login,
login,
agent_login
FROM (account)
WHERE login = '151501'
AND `client_fullname` LIKE "%Testname%"
ORDER BY reg_date DESC
LIMIT 1