mysql
  • codeigniter
  • 2017-03-06 60 views -2 likes 
    -2

    改變如何CI如何在CI

    $sql1= "SELECT kwsn,SUM(jumlah) as jumlah, count(DISTINCT y.noid) as noid from 
         (select DISTINCT (a.noid_new) AS noid, a.kwsn FROM tagihandonatur a where Bulan=".$bulan." and kodej='".$_POST['id_usr']."') z 
         left join (SELECT noid,SUM(jumlah) as jumlah FROM report_tagih WHERE ((tanggal>= '".$tgl."' and tanggal<= '".$tgl2."') OR tanggal like '".$tgl."%') and kodej='".$_POST['id_usr']."' 
         group by noid) y on y.noid= z.noid 
         group by z.kwsn order by z.kwsn"; 
    $rs= $dtaccess->Execute($sql1); 
    $dataTotal=$dtaccess->FetchAll($rs); 
    

    回答

    0

    改變CI:

    $sql1="SELECT kwsn,SUM(jumlah) as jumlah ,count(DISTINCT y.noid) as noid from (select DISTINCT (a.noid_new) AS noid, a.kwsn FROM tagihandonatur a where Bulan=".$bulan." and kodej='".$_POST['id_usr']."') z left join (SELECT noid,SUM(jumlah) as jumlah FROM report_tagih WHERE ((tanggal>= '".$tgl."' and tanggal<= '".$tgl2."') OR tanggal like '".$tgl."%') and kodej='".$_POST['id_usr']."' group by noid) y on y.noid= z.noid group by z.kwsn order by z.kwsn"; 
    
    $data = $this->db->query($sql1); 
    if($data->num_rows() > 0) { 
        $d = $q->result_array(); 
        return $d; 
    } else { 
        return array(); 
    } 
    
    相關問題