model query 直接运行语句

浏览:2462 发布日期:2014/09/27 分类:求助交流 关键字: mysql query
        public function get_stop_flag_voucher()
        {
            //$where['stop_flag'] = 'Y';
            //$where['voucher_type'] = array('exp','in (select voucher_type from ebs_vr_ctl)');
            //return $this->field("lower('v_' + voucher_type) as voucher_type")->where($where)->select();
            $sql = "SELECT lower('v_' + voucher_type) as stop_voucher FROM app_voucher_type WHERE stop_flag = 'Y' AND voucher_type in (select voucher_type from ebs_vr_ctl) ";
            return $this->query($sql);
        }
上述代码,直接在navicat mysql里运行没问题。可是通过tp3.2.2运行,结果得不到正确的结果:array(52) {
  [0] => array(1) {
    ["stop_voucher"] => string(1) "0"
  }
  [1] => array(1) {
    ["stop_voucher"] => string(1) "0"
  }
  [2] => array(1) {
    ["stop_voucher"] => string(1) "0"
  }
  [3] => array(1) {
    ["stop_voucher"] => string(1) "0"
  }
  [4] => array(1) {
    ["stop_voucher"] => string(1) "0"
  }
  [5] => array(1) {
最佳答案
评论( 相关
后面还有条评论,点击查看>>