doushan6692 2017-08-08 04:28
浏览 25

如何通过在codeigniter中使用查询构建器类来缩短此查询

I have a query to move the contents from one table to another using native php, after I use Codeigniter I am confused to use Query Builder Class which is most suitable for my needs:

$this->db->query('INSERT INTO t_pr (ID_PR,no_pr,dept,pr_date,pr_create_date,product_name,qty,uom,Remarks,status_line,status_pr,data_entry) 
SELECT ID_PR,no_pr,dept,pr_date,pr_create_date,product_name,qty,uom,Remarks,status_line,status_pr,data_entry FROM t_pr_temp');
  • 写回答

2条回答 默认 最新

  • duanlei4759 2017-08-08 05:59
    关注

    You can't. The ActiveRecord and QueryBuilder does not support INSERT...SELECT functionality.

    With plain SQL you always can do more than via any abstraction layer (e.g. ORM, ActiveRecord, QueryBuilder, etc.), because different DB servers have different native functionalities.

    评论

报告相同问题?

悬赏问题

  • ¥15 微信会员卡接入微信支付商户号收款
  • ¥15 如何获取烟草零售终端数据
  • ¥15 数学建模招标中位数问题
  • ¥15 phython路径名过长报错 不知道什么问题
  • ¥15 深度学习中模型转换该怎么实现
  • ¥15 HLs设计手写数字识别程序编译通不过
  • ¥15 Stata外部命令安装问题求帮助!
  • ¥15 从键盘随机输入A-H中的一串字符串,用七段数码管方法进行绘制。提交代码及运行截图。
  • ¥15 TYPCE母转母,插入认方向
  • ¥15 如何用python向钉钉机器人发送可以放大的图片?