1
나는 예를 들어, costant 접두사가있는 테이블에 id 열을 가지고 있습니다.codeigniter 모델의 활성 레코드 클래스에서 substr 함수를 작성하는 방법은 무엇입니까?
다음SELECT max(cast(substr(`column_name`,3) as unsigned)) FROM `table_name`
내가
CodeIgniter의에서 할 시도하는 방법이다 - NC1, NC2, NC3는 ..... 나는 column.Here 내가 MySQL의에서 그것을 어떻게되는 ID에서 최대 ID를 계산해야$this->db->select_max('cast(substr('column_name',3) as unsigned'),false));
$result=$this->db->get('table_name');
그냥 작동하지 않습니다. 위의 코드에 어떤 문제가 있습니까?
당신이 쿼리의 개폐 브래킷을 확인 했 결과 필드를 이름을 변경하는 것입니다? '$ this-> db-> select_max ('unsigned'로 캐스팅 (substr ('column_name', 3)), false); –
참으로 언젠가는 braindead이었습니다. 오류 : - 오류 번호 : 1064 SELECT MAX (cast (substr ("ncid", 3) unsigned)) AS cast (substr ("ncid", 3) unsigned) FROM ('reelconsumption') – Skeptic