Php 将sql查询转换为CodeIgniter

Php 将sql查询转换为CodeIgniter,php,codeigniter-3,Php,Codeigniter 3,不存在将SQL查询转换为CodeIgniter这样的事情 如果您希望让查询在CodeIgniter的查询生成器中工作,那么按照此处的文档应该很容易: 我希望这对你有帮助 SELECT * FROM `tb_slots` WHERE `service_name`='Paragliding' and repetition > ( SELECT count(*) FROM `user_booking`

不存在将SQL查询转换为CodeIgniter这样的事情

如果您希望让查询在CodeIgniter的查询生成器中工作,那么按照此处的文档应该很容易:
我希望这对你有帮助

SELECT * 
FROM `tb_slots` 
WHERE `service_name`='Paragliding' 
and repetition > (
                    SELECT count(*) 
                    FROM `user_booking` 
                    WHERE date='2019-11-17' 
                    and `time-session`=`tb_slots`.`id` 
                    and `pay_status`='Success'
                    );

谢谢

错误号:1064您的SQL语法有错误;检查与您的MariaDB服务器版本对应的手册,了解第4行附近要使用的正确语法,从tb_插槽中选择*服务名称='滑翔伞',重复>从用户预订中选择计数*,日期=2019-12-12,时间会话=tb_插槽.id和付款状态=成功文件名:C:/xampp/htdocs/paragliding/system/database/DB_driver.php行号:691缺少paranthsis,请再次查看$此->数据库->选择$这->数据库->其中的'服务名称','滑翔伞'$此->数据库->其中“重复>从用户预订中选择计数,其中日期=2019-11-17,时间会话=tb_slots.id,付款状态=成功”$这->数据库->获取“tb_插槽”;
$this->db->select('*');     
    $this->db->where('service_name','Paragliding');
    $this->db->where('`repetition` > (SELECT count(*) FROM user_booking WHERE date="2019-11-17" and time-session=tb_slots.id and pay_status="Success"'));
    $this->db->get('tb_slots');