如何使用内部连接codeigniter查询

时间:2015-01-12 03:17:43

标签: sql codeigniter

<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.10.0/jquery.min.js"></script>
$data = array(
        'vlc.*',
        'sysinfo_cluster.*'
);

$this->db->select($data);
$this->db->from('vlc');
$this->db->join('sysinfo_cluster','vlc.DATE=sysinfo_cluster.DATE','inner');

我需要添加查询,例如vlc.CLUSTER_CHANNEL =“padang” 这里是我的模型脚本

1 个答案:

答案 0 :(得分:1)

试试这段代码

        $this->db->select('vlc.*,sysinfo_cluster.*')
                 ->from('vlc')
                 ->join('sysinfo_cluster','vlc.DATE=sysinfo_cluster.DATE','inner')
                 ->where('vlc.CLUSTER_CHANNEL','padang');
        $query  = $this->db->get();
        $result = $query->result();
        print_r($result);