CI 묻고 답하기

제목 액티브 레보드 작성시에 질문
글쓴이 이지포토 작성시각 2012/12/11 10:22:28
댓글 : 3 추천 : 0 스크랩 : 0 조회수 : 13893   RSS
원본
$this->db->select( "ie.*, 
  ic.codename as aName, 
  ia.aName as bName, 
  ipe.pName, 
  iam.iamIdx,iam.Regdate as ExamDate, 
  iwm.iwmIdx, iwm.imtcmIdx_als, iwm.imtcmIdx_ard, iwm.imtcmIdx_asp, iwm.imtcmIdx_awr, REPLACE(imtc.iwmIdx_text,'->Part1->','') as iwmIdx_text,
  (select count(tia.iaIdx) 
   from ibtanswer as tia 
   where tia.iamIdx=iam.iamIdx) as input_answerCount, 
     imtc.answerCount as total_answerCount, 
     (SELECT count(t_ia.iaIdx) 
     from ibtanswer as t_ia 
     where t_ia.qAnswer = NULL 
     AND t_ia.iamIdx = iam.iamIdx) as answerCheck");
  $this->db->from($this->table_name.' ie', false);
  --- 중 략 --


쿼리를 찍어보니깐 아래와 같습니다.

SELECT `ie`.*, 
       `ic`.`codename` as aName, 
       `ia`.`aName` as bName, 
       `ipe`.`pName`, 
       `iam`.`iamIdx`, 
       `iam`.`Regdate` as ExamDate, 
       `iwm`.`iwmIdx`, 
       `iwm`.`imtcmIdx_als`, 
       `iwm`.`imtcmIdx_ard`, 
       `iwm`.`imtcmIdx_asp`, 
       `iwm`.`imtcmIdx_awr`, 
       REPLACE(imtc.iwmIdx_text, `'->Part1->'`, `'')` as iwmIdx_text, (SELECT count(tia.iaIdx) FROM ibtanswer as tia WHERE tia.iamIdx=iam.iamIdx) as input_answerCount, 
       `imtc`.`answerCount` as total_answerCount, 
       (SELECT count(t_ia.iaIdx) 
         FROM ibtanswer as t_ia 
        WHERE t_ia.qAnswer = NULL 
              AND t_ia.iamIdx = iam.iamIdx
       ) as answerCheck 
  FROM (`ibtentrant` ie)
  --- 중 략 --
즉 REPLACE(imtc.iwmIdx_text, `'->Part1->'`, `'')` as iwmIdx_text  요게 이렇게 나오네요.
해결방법좀 부탁..
 다음글 액티브레코드 mysql과 mssql? (3)
 이전글 생성자를 사용할 경우가.. (1)

댓글

한대승(불의회상) / 2012/12/11 11:46:25 / 추천 0
아래 처럼 사용 하시면 됩니다.

$this->db->select("REPLACE(imtc.iwmIdx_text,'->Part1->','') as iwmIdx_text", FALSE);

변종원(웅파) / 2012/12/11 11:50:01 / 추천 0
 select("구문", FALSE); 입니다.

셀렉트는 파라미터가 2개입니다~
이지포토 / 2012/12/11 11:54:30 / 추천 0

오우.. 불의화상님, 웅파님 감사 합니다. 해결되었습니다.